问题
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.
回答1:
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
回答2:
What's username , its mapbox?
credentials {
username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
来源:https://stackoverflow.com/questions/63066242/mapbox-android-sdk-error-java-lang-classnotfoundexception-didnt-find-class