gpt4 book ai didi

java - 如何解决 "Duplicate class com.google.android.gms.common.api.zzb found in modules jetified-play-services-base-11.0.1-runtime.jar"

转载 作者:行者123 更新时间:2023-12-04 12:20:59 29 4
gpt4 key购买 nike

我是 Android Studio 开发的新手。我在我的项目中遇到了这个错误。

Duplicate class com.google.android.gms.common.api.zzb found in modules jetified-play-services-base-11.0.1-runtime.jar



这是我的应用程序 Gradle 依赖 代码 (build.gradle(模块:app))
dependencies {
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.google.android.gms:play-services-ads:18.3.0'
implementation 'com.google.android.gms:play-services:11.0.1'
}

这是完整的错误:
Cause 1: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Duplicate class com.google.android.gms.common.api.zza found in modules jetified-play-services-base-11.0.1-runtime.jar (com.google.android.gms:play-services-base:11.0.1) and jetified-play-services-basement-17.0.0-runtime.jar (com.google.android.gms:play-services-basement:17.0.0)
Duplicate class com.google.android.gms.common.api.zzb found in modules jetified-play-services-base-11.0.1-runtime.jar (com.google.android.gms:play-services-base:11.0.1) and jetified-play-services-basement-17.0.0-runtime.jar (com.google.android.gms:play-services-basement:17.0.0)
Duplicate class com.google.android.gms.common.internal.zzb found in modules jetified-play-services-base-11.0.1-runtime.jar (com.google.android.gms:play-services-base:11.0.1) and jetified-play-services-basement-17.0.0-runtime.jar (com.google.android.gms:play-services-basement:17.0.0)
Duplicate class com.google.android.gms.common.internal.zzq found in modules jetified-play-services-base-11.0.1-runtime.jar (com.google.android.gms:play-services-base:11.0.1) and jetified-play-services-basement-17.0.0-runtime.jar (com.google.android.gms:play-services-basement:17.0.0)
Duplicate class com.google.android.gms.common.internal.zzr found in modules jetified-play-services-base-11.0.1-runtime.jar (com.google.android.gms:play-services-base:11.0.1) and jetified-play-services-basement-17.0.0-runtime.jar (com.google.android.gms:play-services-basement:17.0.0)
Duplicate class com.google.android.gms.common.internal.zzs found in modules jetified-play-services-base-11.0.1-runtime.jar (com.google.android.gms:play-services-base:11.0.1) and jetified-play-services-basement-17.0.0-runtime.jar (com.google.android.gms:play-services-basement:17.0.0)

我在我的项目中使用 FusedLocation 服务以及 Google Ads (Admob)。
import com.google.android.gms.common.api.GoogleApi;
import com.google.android.gms.location.FusedLocationProviderClient;
import android.location.Location;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.MobileAds;

public class MainActivity extends AppCompatActivity
{
private AdView adView;
private InterstitialAd interstitialAd;
FusedLocationProviderClient client;
...

最佳答案

删除这一行:

implementation 'com.google.android.gms:play-services:11.0.1'
play-services-ads:18.3.0将引入一个相当当前的版本,不需要进行喷射。

关于java - 如何解决 "Duplicate class com.google.android.gms.common.api.zzb found in modules jetified-play-services-base-11.0.1-runtime.jar",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58815946/

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