我在使用OsmDroid在地图中集成一些标记时遇到了一些麻烦。事实上,我甚至不在我的App Project中。 我是先锋:绑定项目。 我需要实现一些不在v3.4中的osmbonuspack_v5.1的函数。
我调整了Metadata.xml以使用这些新的jar(我使用的是osmdroid v4.3 / osmbonuspack v5.1和slf4j v1.6.1),但仍有2个错误让我发疯。
如何使用osmbonuspack_v5.1实现这两个类( CleaningTask & DownloadingTask )?
以下是详细信息:
\项目\ OsmDroid \ OsmDroid \ OBJ \调试\产生\ SRC \ Org.Osmdroid.Bonuspack.Cachemanager.CacheManager.cs(36,36): 错误CS0534: 'Org.Osmdroid.Bonuspack.Cachemanager.CacheManager.CleaningTask' n'implémentepasle membreabstracthérité 'Android.OS.AsyncTask.DoInBackground(params Java.Lang.Object [])' (CS0534)(OsmDroid)
\项目\ OsmDroid \ OsmDroid \ OBJ \调试\产生\ SRC \ Org.Osmdroid.Bonuspack.Cachemanager.CacheManager.cs(36,36): 错误CS0534: 'Org.Osmdroid.Bonuspack.Cachemanager.CacheManager.DownloadingTask' n'implémentepasle membreabstracthérité 'Android.OS.AsyncTask.DoInBackground(params Java.Lang.Object [])' (CS0534)(OsmDroid)
这是我的Metadata.xml:
<metadata>
<!-- fixup the namespaces, notice that we have to do one for each namespace. -->
<attr path="/api/package[@name='org.osmdroid']" name="managedName">OsmDroid</attr>
<attr path="/api/package[@name='org.osmdroid.api']" name="managedName">OsmDroid.Api</attr>
<attr path="/api/package[@name='org.osmdroid.contributor']" name="managedName">OsmDroid.Contributor</attr>
<attr path="/api/package[@name='org.osmdroid.contributor.util']" name="managedName">OsmDroid.Contributor.Util</attr>
<attr path="/api/package[@name='org.osmdroid.contributor.util.constants']" name="managedName">OsmDroid.Util.Constants</attr>
<attr path="/api/package[@name='org.osmdroid.events']" name="managedName">OsmDroid.Events</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider']" name="managedName">OsmDroid.TileProvider</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider.constants']" name="managedName">OsmDroid.TileProvider.Constants</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider.modules']" name="managedName">OsmDroid.TileProvider.Modules</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider.tilesource']" name="managedName">OsmDroid.TileProvider.TileSource</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider.util']" name="managedName">OsmDroid.TileProvider.Util</attr>
<attr path="/api/package[@name='org.osmdroid.util']" name="managedName">OsmDroid.Util</attr>
<attr path="/api/package[@name='org.osmdroid.views']" name="managedName">OsmDroid.Views</attr>
<attr path="/api/package[@name='org.osmdroid.views.overlay']" name="managedName">OsmDroid.Views.Overlay</attr>
<attr path="/api/package[@name='org.osmdroid.views.util.constants']" name="managedName">OsmDroid.Views.Util.Constants</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.overlays']" name="managedName">OsmDroid.Bonuspack.Overlays</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.routing']" name="managedName">OsmDroid.Bonuspack.Routing</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.overlays.marker']" name="managedName">OsmDroid.Bonuspack.Overlays.Marker</attr>
<!-- different scoping rules in .NET, so we make these public -->
<attr path="/api/package[@name='org.osmdroid.tileprovider.modules']/class[@name='MapTileModuleProviderBase.TileLoader']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider.modules']/class[@name='MapTileModuleProviderBase.TileLoader']/method[@name='loadTile']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider']/class[@name='MapTileProviderBase.ScaleTileLooper']/method[@name='handleTile']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider']/class[@name='MapTileProviderBase.ZoomInTileLooper']/method[@name='handleTile']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.tileprovider']/class[@name='MapTileProviderBase.ZoomOutTileLooper']/method[@name='handleTile']" name="visibility">public</attr>
<!-- Draw() seems to be public for android so we need to be consistent about it. C# doesn't like to mix visibility during inheritance. -->
<attr path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='Overlay']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='TilesOverlay']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='PathOverlay']/method[@name='draw']" name="visibility">public</attr>
<!-- added for 4.2 jar -->
<attr path="/api/package[@name='org.osmdroid.views.overlay.compass']/class[@name='CompassOverlay']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.clustering']/class[@name='MarkerClusterer']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.overlays']/class[@name='FolderOverlay']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.overlays']/class[@name='GroundOverlay']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.overlays']/class[@name='Polygon']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.overlays']/class[@name='Polyline']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.views.overlay.mylocation']/class[@name='MyLocationNewOverlay']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='ItemizedOverlay']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='NonAcceleratedOverlay']/method[@name='draw']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='ScaleBarOverlay']/method[@name='draw']" name="visibility">public</attr>
<remove-node path="/api/package[@name='org.osmdroid.tileprovider.tilesource']/class[@name='CloudmadeTileSource']" />
<!-- Return IMapController in MapView.Controller so that we match IMapView. -->
<attr path="/api/package[@name='org.osmdroid.views']/class[@name='MapView']/method[@name='getController']" name="managedReturn">
OsmDroid.Api.IMapController
</attr>
<!-- We need to rename class MapView.Projection because it conflicts with a property of the same name -->
<attr path="/api/package[@name='org.osmdroid.views']/class[@name='MapView.Projection']" name="managedName">
MapView.ProjectionImpl
</attr>
<!-- Change return type to match IMapView.Projection property return type -->
<attr path="/api/package[@name='org.osmdroid.views']/class[@name='MapView']/method[@name='getProjection']" name="managedReturn">
OsmDroid.Api.IProjection
</attr>
<attr path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='OverlayManager']/method[@name='get' and count(parameter)=1 and parameter[1][@type='int']]" name="managedReturn"> Java.Lang.Object
</attr>
<!-- For update 5.1 but doesn't work
<attr path="/api/package[@name='org.osmdroid.bonuspack.cachemanager']/class[@name='CacheManager.CleaningTask']/method[@name='DoInBackground' and count(parameter)=1 and parameter[1][@type='int']]" name="managedReturn">
</attr>
Java.Lang.
<attr path="/api/package[@name='org.osmdroid.bonuspack.cachemanager']/class[@name='CacheManager.DownloadingTask']/method[@name='DoInBackground' and count(parameter)=1 and parameter[1][@type='int']]" name="managedReturn">
</attr>
-->
<!-- fix up some parameter names -->
<attr path="/api/package[@name='org.osmdroid.views']/class[@name='MapView']/method[@name='setTileSource']/parameter[@name='p0']" name="name">tileSource</attr>
<attr path="/api/package[@name='org.osmdroid.views']/class[@name='MapView']/method[@name='setBuiltInZoomControls']/parameter[@name='p0']" name="name">show</attr>
<attr path="/api/package[@name='org.osmdroid.api']/interface[@name='IMapController']/method[@name='setZoom']/parameter[@name='p0']" name="name">zoomLevel</attr>
<attr path="/api/package[@name='org.osmdroid.api']/interface[@name='IMapController']/method[@name='setCenter']/parameter[@name='p0']" name="name">centreOfMap</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.routing']/class[@name='RoadLink']" name="visibility">public</attr>
<attr path="/api/package[@name='org.osmdroid.bonuspack.overlays']/class[@name='MapEventsOverlay']/method[@name='draw']" name="visibility">public</attr>
</metadata>
这里是错误的参考:
// Metadata.xml XPath class reference: path="/api/package[@name='org.osmdroid.bonuspack.cachemanager']/class[@name='CacheManager.CleaningTask']"
[global::Android.Runtime.Register ("org/osmdroid/bonuspack/cachemanager/CacheManager$CleaningTask", DoNotGenerateAcw=true)]
protected internal partial class CleaningTask : global::Org.Osmdroid.Bonuspack.Cachemanager.CacheManager.CacheManagerTask {
internal static new IntPtr java_class_handle;
internal static new IntPtr class_ref {
get {
return JNIEnv.FindClass ("org/osmdroid/bonuspack/cachemanager/CacheManager$CleaningTask", ref java_class_handle);
}
}
和
// Metadata.xml XPath class reference: path="/api/package[@name='org.osmdroid.bonuspack.cachemanager']/class[@name='CacheManager.DownloadingTask']"
[global::Android.Runtime.Register ("org/osmdroid/bonuspack/cachemanager/CacheManager$DownloadingTask", DoNotGenerateAcw=true)]
protected internal partial class DownloadingTask : global::Org.Osmdroid.Bonuspack.Cachemanager.CacheManager.CacheManagerTask {
internal static new IntPtr java_class_handle;
internal static new IntPtr class_ref {
get {
return JNIEnv.FindClass ("org/osmdroid/bonuspack/cachemanager/CacheManager$DownloadingTask", ref java_class_handle);
}
}
我已经按照http://developer.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_%28.jar%29/上的教程,但我不明白如何处理我的Java.Lang.Object。
提前感谢,我认为这很简单,但我肯定没有得到它。