MapboxTelemetry导致崩溃(无虚拟方法初始化)

时间:2017-11-02 09:18:29

标签: android mapbox mapbox-android

在没有与Mapbox相关的类中进行任何更改,我在运行应用程序后立即崩溃。

我不知道造成这种情况的原因,并且无法在任何地方找到任何响应。

这些是我的gradle依赖项:

compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:5.2.0-beta.3@aar'){
    transitive=true
}

compile 'com.mapbox.mapboxsdk:mapbox-android-services:2.3.0-SNAPSHOT'

这是崩溃日志

  

致命的例外:主要                                                                                        处理:com.example.myapp,PID:16817                                                                                        java.lang.NoSuchMethodError:没有虚拟方法初始化(Landroid / content / Context; Ljava / lang / String; Ljava / lang / String; Lcom / mapbox / services / android / telemetry / location / LocationEngine;)类Lcom / mapbox中的V /服务/安卓/遥测/ MapboxTelemetry;或其超类(声明' com.mapbox.services.android.telemetry.MapboxTelemetry'出现在/data/app/com.example.myapp-4RgMqGrrEFZc1X5nPn936g==/base.apk:classes84.dex)                                                                                            在com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:58)                                                                                            在com.example.myapp.App.onCreate(App.java:128)                                                                                            在android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)                                                                                            在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)                                                                                            在android.app.ActivityThread.-wrap1(未知来源:0)                                                                                            在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1661)                                                                                            在android.os.Handler.dispatchMessage(Handler.java:105)                                                                                            在android.os.Looper.loop(Looper.java:164)                                                                                            在android.app.ActivityThread.main(ActivityThread.java:6541)                                                                                            at java.lang.reflect.Method.invoke(Native Method)                                                                                            在com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240)                                                                                            在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

     

11-02 10:10:3​​5.386 16817-16817 / com.example.myapp E / CrashlyticsCore:执行任务失败。                                                                                         java.util.concurrent.TimeoutException                                                                                             at java.util.concurrent.FutureTask.get(FutureTask.java:206)                                                                                             at com.crashlytics.android.core.CrashlyticsExecutorServiceWrapper.executeSyncLoggingException(CrashlyticsExecutorServiceWrapper.java:44)                                                                                             at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:251)                                                                                             at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)                                                                                             at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)                                                                                             在java.lang.Thread.dispatchUncaughtException(Thread.java:1953)

1 个答案:

答案 0 :(得分:1)

经过几个小时的挣扎,我发现存在某种依赖冲突。在Mapbox.getInstance方法内部检查时,传递给MapboxTelemetry.getInstance的LocationEngine参数未从正确的包中获取。

长话短说,这些是避免这种令人讨厌的崩溃所需的gradle依赖:

compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:5.2.0-beta.3@aar'){
    transitive=true
    exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-services'
}

compile ('com.mapbox.mapboxsdk:mapbox-android-services:2.3.0-SNAPSHOT') {
    exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-sdk'
    exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
}

我希望这有助于任何人!