3

I'm trying to integrate mapbox navigation in my android app and when I am trying to run the code for testing on a mobile phone, I get this error.

The strange thing is that if I run it on the emulator it works without any problem...

I've already tried to google this error but I just cannot find any answer that can help me.

The error I get is the following

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: upt.cti.com.testapp, PID: 20632
    java.lang.RuntimeException: Unable to get provider com.mapbox.android.telemetry.provider.MapboxTelemetryInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.telemetry.provider.MapboxTelemetryInitProvider" on path: DexPathList[[zip file "/data/app/upt.cti.com.testapp-W7F_WF7ciClLNb_MtYNj9g==/base.apk"],nativeLibraryDirectories=[/data/app/upt.cti.com.testapp-W7F_WF7ciClLNb_MtYNj9g==/lib/arm64, /data/app/upt.cti.com.testapp-W7F_WF7ciClLNb_MtYNj9g==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /product/lib64]]
        at android.app.ActivityThread.installProvider(ActivityThread.java:7215)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6699)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6600)
        at android.app.ActivityThread.-wrap2(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:108)
        at android.os.Looper.loop(Looper.java:166)
        at android.app.ActivityThread.main(ActivityThread.java:7529)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.telemetry.provider.MapboxTelemetryInitProvider" on path: DexPathList[[zip file "/data/app/upt.cti.com.testapp-W7F_WF7ciClLNb_MtYNj9g==/base.apk"],nativeLibraryDirectories=[/data/app/upt.cti.com.testapp-W7F_WF7ciClLNb_MtYNj9g==/lib/arm64, /data/app/upt.cti.com.testapp-W7F_WF7ciClLNb_MtYNj9g==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /product/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.ActivityThread.installProvider(ActivityThread.java:7200)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6699) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6600) 
        at android.app.ActivityThread.-wrap2(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
        at android.os.Handler.dispatchMessage(Handler.java:108) 
        at android.os.Looper.loop(Looper.java:166) 
        at android.app.ActivityThread.main(ActivityThread.java:7529) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 
        Suppressed: java.io.IOException: Failed to open dex files from /data/app/upt.cti.com.testapp-W7F_WF7ciClLNb_MtYNj9g==/base.apk because: Failure to verify dex file '/data/app/upt.cti.com.testapp-W7F_WF7ciClLNb_MtYNj9g==/base.apk': Bad method handle type 7
        at dalvik.system.DexFile.openDexFileNative(Native Method)
        at dalvik.system.DexFile.openDexFile(DexFile.java:353)
        at dalvik.system.DexFile.<init>(DexFile.java:100)
        at dalvik.system.DexFile.<init>(DexFile.java:74)
        at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
        at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
        at dalvik.system.DexPathList.<init>(DexPathList.java:157)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
        at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
        at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:75)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:38)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:719)
        at android.app.LoadedApk.getClassLoader(LoadedApk.java:752)
        at android.app.LoadedApk.getResources(LoadedApk.java:1005)
        at android.app.ContextImpl.createAppContext(ContextImpl.java:2489)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6497)
                ... 8 more

and the graddle file is the following:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "upt.cti.com.testapp"
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
    maven { url 'https://mapbox.bintray.com/mapbox' }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.2'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.37.0'
}

I am trying to create my own navigation app following this tutorial but I got stuck at getting directions.

https://docs.mapbox.com/help/tutorials/android-navigation-sdk/

3 Answers 3

4

I believe that you're running into a known issue that was flagged on the Android Navigation SDK's open source repo here: https://github.com/mapbox/mapbox-navigation-android/issues/1982#issuecomment-505955023

Copy/pasting from the dev team's response:

This issue specifically is caused because the Events version included in Mapbox Maps SDK doesn't include the Navigation events 👀 mapbox/mapbox-events-android#383 - this was included in Events v4.5.0 and Events v4.5.1 landed in Maps v8.1.0 mapbox/mapbox-gl-native#14874 (any previous versions work 👌). We're tracking the work needed in the Navigation SDK side in #1890

There's a workaround that could be made in the meantime which is excluding the Events dependency from Maps SDK so that Events v4.4.1 from the Navigation SDK is used 👀

implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:8.1.0') {
  exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
}
Sign up to request clarification or add additional context in comments.

Comments

0

I had the exact same issue and could fix it by doing the following:

I removed any androidTestImplementation and testImplementation from my build.gradle file and also I had to change any android.support...ConstraintLayout to androidx.constraintlayout.widget.ConstraintLayout

Hopefully that will also help you.

EDIT:

I started another project and got the same issue again. I had to add

    compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

to my module build.gradle file.

Comments

0

Actually if you are using NavigationUi SDK then you didn't need to use Mapbox SDK as it is already included in the NavigationUi SDK .Actually i ran into same kind of problem where it was missing Telemetry/NavigationMetaData class.

But the answer from answer from Guardiola31337 in Github resolvi helped me understand my problem, well i just gave it a shot by removing mapbox sdk from implementing keeping only the NavigationUi part and that worked for me, maybe the presence of mapbox sdk was creating some sort of conflicts because of which that error was arising.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.