我一直在尝试从 Mapbox 4.xx 升级到 Mapbox 5.xx 它编译并且应用程序运行,但是在 Mapbox 的实例创建时它崩溃并出现以下错误:
I/art: Rejecting re-init on previously-failed class java.lang.Class<com.mapbox.services.android.telemetry.location.LostLocationEngine>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapzen/android/lost/api/LostApiClient$ConnectionCallbacks;
I/art: at java.util.Map com.mapbox.services.android.telemetry.location.LocationEngineProvider.obtainDefaultLocationEnginesDictionary() (LocationEngineProvider.java:54)
I/art: at void com.mapbox.services.android.telemetry.location.LocationEngineProvider.initAvailableLocationEngines(android.content.Context) (LocationEngineProvider.java:40)
I/art: at void com.mapbox.services.android.telemetry.location.LocationEngineProvider.<init>(android.content.Context) (LocationEngineProvider.java:23)
I/art: at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:54)
I/art: at void com.studentservices.lostoncampus.AnalyticsApplication.onCreate() (AnalyticsApplication.java:45)
I/art: at void android.app.Instrumentation.callApplicationOnCreate(android.app.Application) (Instrumentation.java:1032)
I/art: at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5881)
I/art: at void android.app.ActivityThread.-wrap3(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
I/art: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1718)
I/art: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
I/art: at void android.os.Looper.loop() (Looper.java:154)
I/art: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6688)
I/art: at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/art: at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
I/art: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapzen.android.lost.api.LostApiClient$ConnectionCallbacks" on path: DexPathList[[zip file "/data/app/com.studentservices.lostoncampus-1/base.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.studentservices.lostoncampus-1/s
I/art: at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/art: at java.util.Map com.mapbox.services.android.telemetry.location.LocationEngineProvider.obtainDefaultLocationEnginesDictionary() (LocationEngineProvider.java:54)
I/art: at void com.mapbox.services.android.telemetry.location.LocationEngineProvider.initAvailableLocationEngines(android.content.Context) (LocationEngineProvider.java:40)
I/art: at void com.mapbox.services.android.telemetry.location.LocationEngineProvider.<init>(android.content.Context) (LocationEngineProvider.java:23)
I/art: at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:54)
I/art: at void com.studentservices.lostoncampus.AnalyticsApplication.onCreate() (AnalyticsApplication.java:45)
I/art: at void android.app.Instrumentation.callApplicationOnCreate(android.app.Application) (Instrumentation.java:1032)
I/art: at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5881)
I/art: at void android.app.ActivityThread.-wrap3(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
I/art: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1718)
I/art: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
I/art: at void android.os.Looper.loop() (Looper.java:154)
I/art: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6688)
I/art: at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/art: at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
I/art: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
我有以下 Mapbox 依赖项:
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.4.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.3.0'
我不太确定发生了什么。我已经尝试过干净的构建,启用多 dex 并在没有任何运气的情况下使缓存/重新启动无效,任何建议将不胜感激。
编辑:如果我添加似乎可以工作 -
implementation "com.mapzen.android:lost:3.0.2"