我想为Android使用Mapbox PlacePicker插件。 我的应用程序build.gladle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.fraczekkrzysztof.gocycling"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
release {
storeFile file("C:/AndroidProjects/GoCycling/GoCyclingKey.jks")
storePassword "kf90pesymista"
keyAlias "key0"
keyPassword "kf90pesymista"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
repositories{
mavenCentral()
}
dependencies {
// Add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-ads:18.3.0'
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.android.support:recyclerview-v7:28.0.0'
implementation 'com.loopj.android:android-async-http:1.4.10'
implementation 'com.firebaseui:firebase-ui-auth:6.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
def work_version = "2.3.4"
implementation "androidx.work:work-runtime:$work_version"
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.0.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.10.0'
}
当我尝试运行应用程序时收到错误消息
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.fraczekkrzysztof.gocycling-NYX_OCILRQtudk9ms3B-kA==/base.apk"],nativeLibraryDirectories=[/data/app/com.fraczekkrzysztof.gocycling-NYX_OCILRQtudk9ms3B-kA==/lib/x86, /data/app/com.fraczekkrzysztof.gocycling-NYX_OCILRQtudk9ms3B-kA==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:6288)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
我没有找到PlacePicker的解决方案。在导航中有一些有关类似错误的信息,但在PlacePicker中没有。 如果我删除了PlacePicker依赖关系,则应用程序将正确启动。
答案 0 :(得分:0)
您是否已在Android Studio中清理并重建了项目?我强烈建议您同时在Android Studio中使缓存无效并重新启动:What does the Invalidate Caches/Restart do in Android Studio?