我有一个功能齐全的映射Android应用程序,用osmdroid和(非常有用的)osm奖励包库开发。我使用过osmdroid 3.0.10和osm bonus pack v3.6。我一直想要迁移到osm bonus pack v4.2.9一段时间,以使用一些新的功能,如标记聚类。当我试图改变这一切时,第一个问题来自于使用FolderOverlay替换标记的分组,如osm bonus pack教程中所述,以及定义时:
FolderOverlay = new FolderOverlay(this);
崩溃,使用以下logcat输出
03-27 17:37:54.385 222-222/org.downtherabbithole E/AndroidRuntime﹕ java.lang.RuntimeException: Unable to start activity ComponentInfo{org.downtherabbithole/org.downtherabbithole.GeneralMapViews.GeneralMapActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at org.osmdroid.views.overlay.OverlayManager.setTilesOverlay(OverlayManager.java:92)
at org.osmdroid.views.overlay.OverlayManager.<init>(OverlayManager.java:27)
at org.osmdroid.bonuspack.overlays.FolderOverlay.<init>(FolderOverlay.java:24)
at org.downtherabbithole.droid.GeneralMapViews.GeneralMapActivity.onCreate(GeneralMapActivity.java:128)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
在此之后,按照使用标记聚类的教程,我将GridOverlay替换为GridMarkerClusterer,它不会崩溃,但稍后会尝试设置标记位置
Marker point = new Marker(mapView);
point.setPosition(new GeoPoint(XX.XXXXX, YY.YYYYY));
它崩溃,使用NoSuchMethodError,Geolocation.clone(),为什么这会尝试在Geolocation对象上调用clone()方法,当我使用osm bonus pack v3.6设置ItemizedOverlayWithBubble时它没有尝试这样做
开始
答案 0 :(得分:0)
迁移到OSMBonusPack v4.2.9时,您是否也将osmdroid jar迁移到v4.1?
(这是强制性的:来自v4.2.6的OSMBonusPack jar基于osmdroid v4.1)