如何修复Dependency Error Android Studio

时间:2019-09-11 18:47:18

标签: java android

我正在尝试将Places SDK迁移到新的place sdk。但是在放置所有必需的依赖项之后,IDE会报告依赖项错误。

这些是错误

Duplicate class com.google.android.libraries.places.widget.AutocompleteActivity found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0) Duplicate class com.google.android.libraries.places.widget.zza found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0) Duplicate class com.google.android.libraries.places.widget.zzb found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0) Duplicate class com.google.android.libraries.places.widget.zzc found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0) Duplicate class com.google.android.libraries.places.widget.zzd found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0)

这是我的依赖项

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-database:19.0.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.firebase:geofire-java:3.0.0'
//noinspection GradleCompatible
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.libraries.places:places-      compat:2.0.0'
implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.libraries.places:places:2.0.0'

}

apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

只需删除此依赖项 implementation 'com.google.android.libraries.places:places:2.0.0'

仅使用'com.google.android.libraries.places:places-compat:2.0.0'问题将得到解决。