如何解析在模块jetified-play-services-base-11.0.1-runtime.jar"中找到的重复类com.google.android.gms.common.api.zzb(&Q;)

How to resolve quot;Duplicate class com.google.android.gms.common.api.zzb found in modules jetified-play-services-base-11.0.1-runtime.jarquot;(如何解析在模块jetified-play-services-base-11.0.1-runtime.jarquot;中找到的重复类com.google.android.gms.common.api.zzb(Q;)) - IT

本文介绍了如何解析在模块jetified-play-services-base-11.0.1-runtime.jar"中找到的重复类com.google.android.gms.common.api.zzb(&Q;)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android Studio开发方面的新手。我的项目中出现此错误。

在模块jetified-play-services-base-11.0.1-runtime.jar

中找到重复的类com.google.android.gms.common.api.zzb

以下是我的App Gradle依赖项代码(build.gradle(Module: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 Service和Google Adds(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将引入较新的版本,不需要对其进行删节。

这篇关于如何解析在模块jetified-play-services-base-11.0.1-runtime.jar"中找到的重复类com.google.android.gms.common.api.zzb(&Q;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何解析在模块jetified-play-services-base-11.0.1-runtime.jar"中找到的重复类com.google.android.gms.common.api.zzb(&Q;)

基础教程推荐