错误重复输入:com / google / android / gms / internal / measurement / zzxd.class android studio

时间:2018-05-15 01:13:43

标签: java android android-gradle

当我尝试构建apk时出现此错误:

  

错误:任务':app:transformClassesWithJarMergingForDebug'执行失败。   com.android.build.api.t``ransform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / internal / measurement / zzxd.class

这是我的构建应用代码

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "28.0.0-rc1"
    defaultConfig {
        applicationId "com.appname"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support.constraint:constraint-layout:1.1.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.android.support:design:27.1.1'
compile 'com.google.firebase:firebase-core:15.0.0'
compile 'com.google.firebase:firebase-messaging:15.0.0'
compile 'com.google.android.gms:play-services-ads:15.0.0'
compile 'com.google.firebase:firebase-crash:15.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

提前谢谢

1 个答案:

答案 0 :(得分:1)

我通过将firebase版本更新为最新的

来解决了这个问题
'com.google.firebase:firebase-messaging:15.0.2'
'com.google.android.gms:play-services-ads:15.0.1'
'com.google.firebase:firebase-crash:15.0.2'