英文:
Mapbox android SDK error - java.lang.ClassNotFoundException: Didn't find class "com.mapbox.android.telemetry.MapboxTelemetry"
问题
我已将 Mapbox SDK 添加到现有的 Android 项目中,通过直接下载方式(https://docs.mapbox.com/android/maps/overview/#add-the-dependency)。
我已经像下面这样在 build.gradle 文件中添加了依赖。
implementation project(':mapbox-android-sdk-9.3.0')
在那之后,我已经修改了使用它的源代码,并且成功编译通过了,但在运行时,我遇到了下面的异常。
Caused by: java.lang.ClassNotFoundException: 没有找到类 "com.mapbox.android.telemetry.MapboxTelemetry",路径为: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)
错误是由下面的代码引起的。
Mapbox.getInstance(this.getActivity(), getString(R.string.mapbox_access_token));
希望有人能够帮助我解决这个问题,非常感谢您的评论和反馈。
英文:
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
得分: 1
我认为,“直接下载”进程不起作用,并且它要求许多依赖项,添加了所有这些依赖项后,它要求“libmapbox-gl.so”,因此这个进程不能正常工作。
所以我按照“Maven仓库”添加地图SDK的方式进行,它可以正常工作,而且我们只需要首先根据给定的步骤创建秘密令牌。请按照Maven步骤(第一个选项卡)操作。
https://docs.mapbox.com/android/maps/overview/#add-the-dependency
英文:
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
得分: 0
什么是用户名,它是Mapbox吗?
凭证 {
用户名 = 'mapbox'
// 使用你在gradle.properties中存储的秘密令牌作为密码
密码 = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
英文:
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'] ?: ""
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论