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

Posted

技术标签:

【中文标题】com.google.android.gms.common.api.internal.zza 的依赖关系解析错误【英文标题】:Dependency resolution error for com.google.android.gms.common.api.internal.zza 【发布时间】:2020-07-07 01:14:31 【问题描述】:

我在构建时在 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】:

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

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

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

【讨论】:

以上是关于com.google.android.gms.common.api.internal.zza 的依赖关系解析错误的主要内容,如果未能解决你的问题,请参考以下文章