在包含Google AdMob依赖项之后找到“在模块classes.jar中找到重复的类com.google.android.gms.common.api.internal.zza”

时间:2019-07-03 06:23:04

标签: android android-gradle androidx

这一切都是正确的,当我集成Google Ad Mob依赖项implementation 'com.google.android.gms:play-services-ads:18.0.0'时出现了此错误

Project Level Gradle:

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

模块级别gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.demo.something"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    //Facebook account kit
    implementation 'com.facebook.android:account-kit-sdk:4.39.0'

    //sdp and ssp for dimension and font size
    implementation 'com.intuit.sdp:sdp-android:1.0.6'
    implementation 'com.intuit.ssp:ssp-android:1.0.6'

    //Lottie Animation
    implementation 'com.airbnb.android:lottie:2.8.0'

    //Android Fast Networking for APIs
    implementation 'com.amitshekhar.android:jackson-android-networking:1.0.2'

    //Process Dialog
    implementation 'com.wang.avi:library:2.1.3'

    //Scratch Card
    implementation 'com.github.myinnos:AndroidScratchCard:v1.0'

    //Google AdMob
    implementation 'com.google.android.gms:play-services-ads:17.0.0'
}
  

重复的类com.google.android.gms.common.api.internal.zza在模块classes.jar(com.google.android.gms:play-services-base:11.8.0)和classes.jar( com.google.android.gms:play-services-basement:16.0.1)

1 个答案:

答案 0 :(得分:0)

我已经检查了您在我的项目中的依赖关系,并使用AndroidScratchCard捕获了其他错误。播放服务没有问题。

您可以尝试重建您的项目。