如何在monodroid项目中使用.jar?

时间:2013-04-14 17:52:21

标签: java binding jar xamarin.android

我想在我的monodroid项目中使用百度地图Android SDK。这个SDK下载网址是 http://developer.baidu.com/map/static/doc/BaiduMap_AndroidSDK_v2.1.0_All.zip
我按照Xamarin docs中描述的指示,创建了一个绑定项目,按照文档中的这些步骤,当构建绑定项目时,我收到了消息:

1>------ 已启动全部重新生成: 项目: JuHuiBao.Binding, 配置: Debug Any CPU ------
1>BINDINGSGENERATOR : warning BG8C00: For type System.Byte, base interface System.IComparable`1<System.Byte> does not exist.
1>BINDINGSGENERATOR : warning BG8400: unexpected field type com.baidu.location.BDLocation.a
1>BINDINGSGENERATOR : warning BG8400: unexpected field type com.baidu.location.i
1>BINDINGSGENERATOR : warning BG8102: Class Com.Baidu.Mapapi.Map.Overlay has unknown base type com.baidu.platform.comapi.map.y
1>BINDINGSGENERATOR : warning BG8103: Class Com.Baidu.Mapapi.Map.GraphicsOverlay has invalid base type com.baidu.mapapi.map.Overlay
1>BINDINGSGENERATOR : warning BG8103: Class Com.Baidu.Mapapi.Map.ItemizedOverlay has invalid base type com.baidu.mapapi.map.Overlay
1>BINDINGSGENERATOR : warning BG8701: Invalid return type java.util.List<com.baidu.mapapi.map.Overlay>
1>BINDINGSGENERATOR : warning BG8103: Class Com.Baidu.Mapapi.Map.MyLocationOverlay has invalid base type com.baidu.mapapi.map.Overlay
1>BINDINGSGENERATOR : warning BG8103: Class Com.Baidu.Mapapi.Map.PoiOverlay has invalid base type com.baidu.mapapi.map.Overlay
1>BINDINGSGENERATOR : warning BG8103: Class Com.Baidu.Mapapi.Map.PopupOverlay has invalid base type com.baidu.mapapi.map.Overlay
1>BINDINGSGENERATOR : warning BG8103: Class Com.Baidu.Mapapi.Map.RouteOverlay has invalid base type com.baidu.mapapi.map.ItemizedOverlay
1>BINDINGSGENERATOR : warning BG8103: Class Com.Baidu.Mapapi.Map.TransitOverlay has invalid base type com.baidu.mapapi.map.ItemizedOverlay
1>BINDINGSGENERATOR : warning BG8C00: For type Com.Baidu.Mapapi.Search.PlaceCaterActivity, base interface com.baidu.mapapi.search.a.a does not exist.
1>BINDINGSGENERATOR : warning BG8102: Class Com.Baidu.Platform.Comapi.Map.A has unknown base type com.baidu.platform.comapi.map.i
1>BINDINGSGENERATOR : warning BG8102: Class Com.Baidu.Platform.Comapi.Map.B has unknown base type com.baidu.platform.comapi.map.i
1>BINDINGSGENERATOR : warning BG8102: Class Com.Baidu.Platform.Comapi.Map.C has unknown base type com.baidu.platform.comapi.map.i
1>BINDINGSGENERATOR : warning BG8102: Class Com.Baidu.Platform.Comapi.Map.D has unknown base type com.baidu.platform.comapi.map.i
1>BINDINGSGENERATOR : warning BG8102: Class Com.Baidu.Platform.Comapi.Map.F has unknown base type com.baidu.platform.comapi.map.i
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.baidu.platform.comapi.map.z
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.baidu.platform.comapi.map.u
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.baidu.platform.comapi.map.w
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.baidu.platform.comapi.map.w
1>BINDINGSGENERATOR : warning BG8700: Unknown return type com.baidu.platform.comjni.map.basemap.a
1>BINDINGSGENERATOR : warning BG8700: Unknown return type com.baidu.platform.comapi.map.w
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.baidu.platform.comapi.map.u
1>BINDINGSGENERATOR : warning BG8900: Type com.baidu.platform.comjni.permissioncheck.PermissionCheck: FxDG naming violation: Type name 'PermissionCheck' matches namespace part 'Permissioncheck'.
1>BINDINGSGENERATOR : warning BG8700: Unknown return type com.baidu.vi.i
1>BINDINGSGENERATOR : warning BG8C00: For type Com.Baidu.Mapapi.Search.PlaceCaterActivity, base interface com.baidu.mapapi.search.a.a does not exist.
1>BINDINGSGENERATOR : warning BG8900: Type com.baidu.platform.comjni.permissioncheck.PermissionCheck: FxDG naming violation: Type name 'PermissionCheck' matches namespace part 'Permissioncheck'.
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Mapapi.Search.MKSearch.PoiDetailSearch, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.A, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.B, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.C, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.D, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.E, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.F, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.G, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.H, due to a duplicate field, method or nested type name
1>BINDINGSGENERATOR : warning BG8401: Skipping Com.Baidu.Platform.Comapi.Map.MapController.I, due to a duplicate field, method or nested type name
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(23,17,23,18): warning CS0628: “Com.Baidu.Location.LocationClientOption.A”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(39,20,39,24): warning CS0628: “Com.Baidu.Location.LocationClientOption.Byte”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(58,18,58,22): warning CS0628: “Com.Baidu.Location.LocationClientOption.Case”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(74,20,74,24): warning CS0628: “Com.Baidu.Location.LocationClientOption.Char”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(93,19,93,21): warning CS0628: “Com.Baidu.Location.LocationClientOption.Do”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(109,18,109,22): warning CS0628: “Com.Baidu.Location.LocationClientOption.Else”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(125,18,125,21): warning CS0628: “Com.Baidu.Location.LocationClientOption.For”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(141,17,141,21): warning CS0628: “Com.Baidu.Location.LocationClientOption.Goto”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(157,18,157,20): warning CS0628: “Com.Baidu.Location.LocationClientOption.If”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(173,17,173,20): warning CS0628: “Com.Baidu.Location.LocationClientOption.Int”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(189,17,189,21): warning CS0628: “Com.Baidu.Location.LocationClientOption.Long”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(205,20,205,23): warning CS0628: “Com.Baidu.Location.LocationClientOption.New”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(224,20,224,23): warning CS0628: “Com.Baidu.Location.LocationClientOption.Try”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Location.LocationClientOption.cs(243,18,243,22): warning CS0628: “Com.Baidu.Location.LocationClientOption.Void”: 在密封类中声明了新的保护成员
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Mapapi.Map.MapView.cs(11,24,11,36): warning CS0108: “Com.Baidu.Mapapi.Map.MapView.LayoutParams”隐藏了继承的成员“Android.Views.ViewGroup.LayoutParams”。如果是有意隐藏,请使用关键字 new。
1>J:\Development\JuHuiBao\JuHuiBao.Binding\obj\Debug\generated\src\Com.Baidu.Mapapi.Map.MapView.cs(784,36,784,55): warning CS0618: “Com.Baidu.Mapapi.Map.MapView.ZoomControls”已过时:“deprecated”
1>  JuHuiBao.Binding -> J:\Development\JuHuiBao\JuHuiBao.Binding\bin\Debug\JuHuiBao.Binding.dll
========== 全部重新生成: 成功 1 个,失败 0 个,跳过 0 个 ==========

构建的动作成功有这么多警告,而某些类无法创建,JuHuiBao.Binding.dll无法找到工作。 我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您必须编辑Metadata.xml文件。截至目前,很难设置绑定。一个较新版本的mono for android应该在java中公开一些可能解决你的一些问题的方法。我可以推荐的另一件事是遵循github上Xamarin样本中的一些示例。他们有很多使用绑定的示例,可以帮助您弄清楚如何编辑Metadata.xml文件。