Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapbox app crashes on android api 19 #1982

Closed
mahdit83 opened this issue Jun 24, 2019 · 14 comments
Closed

Mapbox app crashes on android api 19 #1982

mahdit83 opened this issue Jun 24, 2019 · 14 comments

Comments

@mahdit83
Copy link

My app crashes when run on api 19 with this log:

  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/com.mypackage.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapackage, /system/lib]]
        at android.app.ActivityThread.installProvider(ActivityThread.java:4793)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
        at android.app.ActivityThread.access$1500(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.telemetry.provider.MapboxTelemetryInitProvider" on path: DexPathList[[zip file "/data/app/com.mypackage.apk"],nativeLibraryDirectories=[/data/app-lib/com.mypackage, /system/lib]]

Android API: 19
Mapbox Navigation SDK version: 8.1.0

Steps to trigger behavior

  1. Compile and run app on avd or device.
@Guardiola31337
Copy link
Contributor

Hey 👋 @mahdit83 thanks for reaching out and report your issue.

Noting that if you're using the Navigation UI SDK, you don't have to declare the Mapbox Maps SDK, it's included implicitly 👀

implementation dependenciesList.mapboxMapSdk
This is on purpose to avoid these kind of dependencies conflicts.

That being said, we’re always striving to upgrade to the latest versions of the different dependencies included in the SDK. 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'
}

Closing as answered. Please feel free to cut a new ticket if you run into any other issues. Thanks again!

@donlingliang
Copy link

@Guardiola31337
I am trying your temp. solution which excludes the telemetry in gradle as below

implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:8.1.0') {
    exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
}
implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.40.0'

and it is still crashing with the same log unless i am use the navigation-sdk without ui parts, 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.40.0'.

Should I just wait and track the #1890 as well?

@mahdit83
Copy link
Author

Hi @Guardiola31337. Thanks for response.
But i still have the same crash.

@Guardiola31337
Copy link
Contributor

Hey @donlingliang and @mahdit83 👋 could you try with v0.41.0? #1890 landed solving the issue 🎉

Please feel free to cut a new ticket if you run into any other issues with the latest version. Thanks for bringing this to us!

@mahdit83
Copy link
Author

mahdit83 commented Jul 23, 2019

@Guardiola31337 Hi,
I do not using navigation dependecies. These are my dependencies:

    mapBoxVersion = '8.1.0'
    mapBoxPlugginVersion = '0.5.0'

   implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:$mapBoxVersion") {
        exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
    }
   implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-building-v7:$mapBoxPlugginVersion"

@Guardiola31337
Copy link
Contributor

Hey @mahdit83 as indicated in the mapbox-plugins-android README https://github.com/mapbox/mapbox-plugins-android#maps-sdk-compatibility

The Mapbox Plugins for Android are heavily dependent on the major semantic versioning number of the Maps SDK. They either won't compile or hide runtime bugs when paired with a different major version of the Maps SDK. Each plugin's dependency name has a vX suffix which states the major version of the Maps SDK that the plugin is compatible with. This suffix makes the transition between versions easier and more educated without the need to jump into changelogs and compare repositories.

As you're including Maps SDK v8.1.0 you should use mapbox-android-plugin-building-v8 instead.

In any case, if you are not using the Navigation SDK this is not the best place to report this question. Feel free to report any other issue in the mapbox-plugins-android repository. Thanks for understanding.

@langsmith
Copy link
Contributor

Passing by to say that the v7 suffix for building plugin documentation is incorrect. As @Guardiola31337 says above, v8 is correct. The docs will be fixed when https://github.com/mapbox/android-docs/pull/1011 is merged.

@gkosmadakis
Copy link

Hi My app crashes too with this error: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.telemetry.provider.MapboxTelemetryInitProvider" on path: DexPathList
My build.gradle has these related dependencies:
implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:mapbox-android-plugin-building-v8'){
exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'}

 implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.41.0'

implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.11.0'

Any update?

@langsmith
Copy link
Contributor

He @gkosmadakis , thanks for using Mapbox.

  1. Completely uninstall your app from your device.

  2. Invalidate your Android Studio cache and restart Android Studio. https://www.jetbrains.com/help/rider/Cleaning_System_Cache.html#clean-sys-caches. Sometimes this DexPathList issue can happen when dependencies have been added to Gradle files or the dependencies versions have been upgraded.

  3. Try re-installing your app on your device.

@gkosmadakis
Copy link

gkosmadakis commented Apr 17, 2020

Hey @langsmith
I did your steps, well now i get a different error
java.lang.RuntimeException: Unable to instantiate application androidx.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "androidx.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.example.smartorders-de0_rcZt8C3I14WcMba3RA==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.smartorders-de0_rcZt8C3I14WcMba3RA==/lib/x86, /data/app/com.example.smartorders-de0_rcZt8C3I14WcMba3RA==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
Strange because i had this error in the past and had fixed by adding multiDexEnabled true inside my defaultConfig of build.gradle. And now i have addded it also in my manifest file android:name="androidx.multidex.MultiDexApplication" and added it on my dependencies implementation 'androidx.multidex:multidex:2.0.1'
Any ideas?

@gkosmadakis
Copy link

@langsmith @Guardiola31337
I have created a new android project with only the PlacesPluginActivity and its content view xml.
My app level build.gradle has:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.11.0'
}
If i comment the implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.11.0' then the application starts and i see the map but if i include the implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.11.0'
then it crashes with this error:
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
If i try to add the {
exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'} to either the sdk or in the plugin-places-v9:0.11.0 dependencies then i get a different error: Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0() for arguments [build_dp2cwjg133dey8hrq8x6tp2tw$_run_closure2$_closure6@687f7d52] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Clearly there is something wrong with the plugin-places dependency. I need this dependency as i want to implement the global search location.
Please advise.

@langsmith
Copy link
Contributor

I created a new Java project in Android Studio and was able to install it on my physical device. I'm using

My Android Studio info:

Android Studio 3.6.1
Build #AI-192.7142.36.36.6241897, built on February 26, 2020
Runtime version: 1.8.0_212-release-1586-b4-5784211 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.4
GC: ParNew, ConcurrentMarkSweep
Memory: 4062M
Cores: 4
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: AceJump, CheckStyle-IDEA, Key promoter, com.genymotion.idea, Gitflow, eu.inmite.android.plugin.butterknifezelezny, fr.vdl.android.holocolors, mobi.hsz.idea.gitignore, com.google.services.firebase, de.mprengemann.intellij.plugin.androidicons

I did have to add the following compileOptions block to my app-level build.gradle file:

compileOptions {
     sourceCompatibility 1.8
     targetCompatibility 1.8
}

Here's my app-level build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"

    defaultConfig {
        applicationId "com.langsdroid.placesplugintest"
        minSdkVersion 14
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

repositories {
    mavenCentral()
}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0'

    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.11.0'

}

ezgif com-resize

@Zeeshan50522
Copy link

adding
android{
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
in gradle
solve my problem

@KalaliEhsan
Copy link

KalaliEhsan commented Jan 13, 2021

Hey everyone :)
I have same problem and I used your solution about resolve it. But don't resolved :(

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28

    defaultConfig {
        // TODO A_4 change packgename
        applicationId "test.test.com"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    signingConfigs {
        release {
            // TODO A_5 change signkey
            storeFile file("/home/gitlab-runner/signkeys/mashhad1830customer.jks")
            storePassword "47421EbtekaR47421"
            keyAlias "ebtekar"
            keyPassword "47421EbtekaR47421"

        }
    }

    buildTypes {
        debug {
            minifyEnabled false
        }
        release {
            minifyEnabled true
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.android.gms:play-services-maps:8.4.0'
    implementation 'com.google.android.gms:play-services-location:8.4.0'
    implementation 'com.google.android.gms:play-services-plus:8.4.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5+'
    implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
    implementation files('libs/befrest-2.0.1.jar')
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:27.1.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'com.squareup.okhttp3:okhttp:3.12.0'
    implementation 'com.squareup.okio:okio:2.2.2'
    implementation 'com.hanks:htextview-fall:0.1.1'
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    //noinspection GradleCompatible
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'org.adw.library:discrete-seekbar:1.0.1'
    implementation('io.socket:socket.io-client:0.8.3') {
        exclude group: 'org.json', module: 'json'
    }
    def acraVersion = '5.1.3'
    implementation "ch.acra:acra-http:$acraVersion"
    implementation files('libs/ava-0.4.5.jar')
    implementation 'jp.wasabeef:blurry:2.1.1'
    implementation 'ir.map:map-sdk:4.0.2'
    implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:8.1.0') {
        exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
    }
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6'
}

Error is:

01-13 00:18:04.546 2537-2537/test.test.com E/AndroidRuntime: FATAL EXCEPTION: main
    Process: test.test.com, PID: 2537
    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/test.test.com-1.apk"],nativeLibraryDirectories=[/data/app-lib/test.test.com-1, /system/lib]]
        at android.app.ActivityThread.installProvider(ActivityThread.java:4777)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4369)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4309)
        at android.app.ActivityThread.access$1500(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5001)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.telemetry.provider.MapboxTelemetryInitProvider" on path: DexPathList[[zip file "/data/app/test.test.com-1.apk"],nativeLibraryDirectories=[/data/app-lib/test.test.com-1, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
        at android.app.ActivityThread.installProvider(ActivityThread.java:4762)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4369) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4309) 
        at android.app.ActivityThread.access$1500(ActivityThread.java:135) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:136) 
        at android.app.ActivityThread.main(ActivityThread.java:5001) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:515) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
        at dalvik.system.NativeStart.main(Native Method) 

Can you help me please?
@mahdit83
@Guardiola31337
@langsmith

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants