Search code examples
javaandroidandroid-studiomapboxmapbox-android

Mapbox android SDK error - java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.telemetry.MapboxTelemetry"


I have added mapbox sdk to existing android project via direct download (https://docs.mapbox.com/android/maps/overview/#add-the-dependency)

I have added dependancy to build.gradle file like below.

implementation project(':mapbox-android-sdk-9.3.0')

After that i have changed my source code using it and it was complied successfully and , but in runtime i got below exception.

 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.telemetry.MapboxTelemetry" on path: DexPathList[[zip file "/data/app/com.xxxx.yyyy-LPdA94f71sQIsIW4AiNNZw==/base.apk"],nativeLibraryDirectories=[/data/app/com.xxxx.yyyy-LPdA94f71sQIsIW4AiNNZw==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)

error was throwing by below line

Mapbox.getInstance(this.getActivity(), getString(R.string.mapbox_access_token));

Appreciate someone can help me to resolve this issue, thanks lot of your comments and feedback.


Solution

  • I think, direct download process is not working and it asked many dependencies and after adding all of them, it asked libmapbox-gl.so , so this process is not working properly.

    So i followed, map sdk adding via maven repository its working without any issue and we only need to create secret token first according to given steps. Please, follow the Maven steps (first tab) https://docs.mapbox.com/android/maps/overview/#add-the-dependency