我正在尝试为Facebook 通知.aar 库创建绑定。
但是我收到编译错误:
严重性代码 描述 项目文件行抑制状态错误 CS0103 当前上下文中不存在名称“CreateAsset” FBNotifications C:\Users\jakub\documents\visual studio 2015\Projects\FBNotifications\FBNotifications\obj\Release\generated\src\ Com.Facebook.Notifications.Internal.Asset.Handlers.BitmapAssetHandler.cs 344 活动
严重性代码 描述 项目文件行抑制状态错误 CS0103 当前上下文 FBNotifications C:\Users\jakub\documents\visual studio 2015\Projects\FBNotifications\FBNotifications\obj\Release\generated\src\ 中不存在名称“CreateView” Com.Facebook.Notifications.Internal.Asset.Handlers.BitmapAssetHandler.cs 350 活动
有问题的方法如下:
// This method is explicitly implemented as a member of an instantiated Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetHandler
global::Java.Lang.Object global::Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetHandler.CreateAsset (global::Org.Json.JSONObject p0, global::Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetCache p1)
{
return global::Java.Interop.JavaObjectExtensions.JavaCast<Java.Lang.Object>(CreateAsset (p0, p1));
}
// This method is explicitly implemented as a member of an instantiated Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetHandler
global::Android.Views.View global::Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetHandler.CreateView (global::Java.Lang.Object p0, global::Android.Content.Context p1)
{
return CreateView (global::Java.Interop.JavaObjectExtensions.JavaCast<global::Com.Facebook.Notifications.Internal.Asset.Handlers.BitmapAssetHandler.BitmapAsset>(p0), p1);
}
我可以看到代码问题可以这样修复:
// This method is explicitly implemented as a member of an instantiated Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetHandler
global::Java.Lang.Object global::Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetHandler.CreateAsset (global::Org.Json.JSONObject p0, global::Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetCache p1)
{
return global::Java.Interop.JavaObjectExtensions.JavaCast<Java.Lang.Object>(((AssetManager.IAssetHandler)this).CreateAsset (p0, p1));
}
// This method is explicitly implemented as a member of an instantiated Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetHandler
global::Android.Views.View global::Com.Facebook.Notifications.Internal.Asset.AssetManager.IAssetHandler.CreateView (global::Java.Lang.Object p0, global::Android.Content.Context p1)
{
return ((AssetManager.IAssetHandler)this).CreateView (global::Java.Interop.JavaObjectExtensions.JavaCast<global::Com.Facebook.Notifications.Internal.Asset.Handlers.BitmapAssetHandler.BitmapAsset>(p0), p1);
}
我认为为 BitmapAssetHandler 创建一个部分类并将更正的方法放在那里,同时在Metadata.xml中删除它会修复它,但它看起来不像。
<remove-node path="/api/package[@name='com.facebook.notifications.internal.asset.handlers']/class[@name='BitmapAssetHandler']/method[@name='CreateAsset']" />
<remove-node path="/api/package[@name='com.facebook.notifications.internal.asset.handlers']/class[@name='BitmapAssetHandler']/method[@name='CreateView']" />
如果我这样做,那么我会得到错误,即方法存在两次(不知何故,它们不会从生成的代码中删除)。我希望这不是一个太复杂的问题。我的方法正确吗?或者是否需要做其他事情才能使其正常工作。