gpt4 book ai didi

java - 如何修复 : "java. lang.RuntimeException : Unable to get provider com. mapbox.android.telemetry.provider.MapboxTelemetryInitProvider

转载 作者:行者123 更新时间:2023-11-30 12:05:46 27 4
gpt4 key购买 nike

我正在尝试将 mapbox 导航集成到我的 android 应用程序中,当我尝试在手机上运行测试代码时,出现此错误。

奇怪的是,如果我在模拟器上运行它,它可以毫无问题地运行...

我已经尝试用谷歌搜索这个错误,但我找不到任何可以帮助我的答案。

我得到的错误如下

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

gradle 文件如下:

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'
}

我正尝试按照本教程创建自己的导航应用程序,但我在获取方向时遇到了困难。

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

最佳答案

我相信您遇到了一个已知问题,该问题已在 Android Navigation SDK 的开源存储库中标记:https://github.com/mapbox/mapbox-navigation-android/issues/1982#issuecomment-505955023

从开发团队的回复中复制/粘贴:

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'
}

关于java - 如何修复 : "java. lang.RuntimeException : Unable to get provider com. mapbox.android.telemetry.provider.MapboxTelemetryInitProvider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56044314/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com