com.google.android.gms.common.api.internal.zza的依赖项解析错误

时间:2020-03-26 11:54:11

标签: android android-studio gradle google-play-services

构建时,我在Android Studio 3.6.1中遇到以下错误:

Android Studio刚建议更新Firebase,而我做了。

Duplicate class com.google.android.gms.common.api.internal.zzb found in modules jetified-play-services-base-11.6.0-runtime.jar (com.google.android.gms:play-services-base:11.6.0) and jetified-play-services-basement-17.2.0-runtime.jar (com.google.android.gms:play-services-basement:17.2.0)
Duplicate class com.google.android.gms.common.api.internal.zzc found in modules jetified-play-services-base-11.6.0-runtime.jar (com.google.android.gms:play-services-base:11.6.0) and jetified-play-services-basement-17.2.0-runtime.jar (com.google.android.gms:play-services-basement:17.2.0)
Duplicate class com.google.android.gms.common.api.internal.zzd found in modules jetified-play-services-base-11.6.0-runtime.jar (com.google.android.gms:play-services-base:11.6.0) and jetified-play-services-basement-17.2.0-runtime.jar (com.google.android.gms:play-services-basement:17.2.0)
Duplicate class com.google.android.gms.common.api.zza found in modules jetified-play-services-base-11.6.0-runtime.jar (com.google.android.gms:play-services-base:11.6.0) and jetified-play-services-basement-17.2.0-runtime.jar (com.google.android.gms:play-services-basement:17.2.0)
Duplicate class com.google.android.gms.common.api.zzb found in modules jetified-play-services-base-11.6.0-runtime.jar (com.google.android.gms:play-services-base:11.6.0) and jetified-play-services-basement-17.2.0-runtime.jar (com.google.android.gms:play-services-basement:17.2.0)
Duplicate class com.google.android.gms.common.internal.zzb found in modules jetified-play-services-base-11.6.0-runtime.jar (com.google.android.gms:play-services-base:11.6.0) and jetified-play-services-basement-17.2.0-runtime.jar (com.google.android.gms:play-services-basement:17.2.0)
Duplicate class com.google.android.gms.common.internal.zzr found in modules jetified-play-services-base-11.6.0-runtime.jar (com.google.android.gms:play-services-base:11.6.0) and jetified-play-services-basement-17.2.0-runtime.jar (com.google.android.gms:play-services-basement:17.2.0)
Duplicate class com.google.android.gms.common.internal.zzs found in modules jetified-play-services-base-11.6.0-runtime.jar (com.google.android.gms:play-services-base:11.6.0) and jetified-play-services-basement-17.2.0-runtime.jar (com.google.android.gms:play-services-basement:17.2.0)
Go to the documentation to learn how to Fix dependency resolution errors.

我正在使用gradle-5.6.4

我按照其他一些线程的建议将其添加到了build.gradle中,但未成功:

configurations.all {
    resolutionStrategy {
        force 'com.google.android.gms:play-services-basement:17.2.0'
    }
}

1 个答案:

答案 0 :(得分:0)

为我的所有依赖项添加了一个例外:

implementation ('com.some.dependency:x.x.x') {
        transitive = true
        exclude group: 'com.google.android.gms'
}

然后将其从所有依赖项中一一删除,直到找到使用过时的'com.google.android.gms'的罪魁祸首包为止。