android:错误:任务执行失败':app:transformClassesWithJarMergingForDebug'

时间:2017-09-03 17:55:52

标签: android

更新android studio和几个依赖项后,我现在收到此错误消息

  

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

这是我的gradle文件 apply plugin:'com.android.application'

apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'com.google.firebase.firebase-perf'



android {
    compileSdkVersion 26
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "REMOVED_FOR_PRIVACY"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

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'
    })

    // compile 'com.firebaseui:firebase-ui:1.2.0'

    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }






    compile 'com.android.support:appcompat-v7:26.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:mediarouter-v7:26.0.2'
    compile 'com.google.android.gms:play-services-location:11.2.0'
    compile 'com.google.firebase:firebase-core:11.2.0'
    compile 'com.google.firebase:firebase-crash:11.2.0'
    compile 'com.google.firebase:firebase-auth:11.2.0'
    compile 'com.google.firebase:firebase-messaging:11.2.0'
    compile 'com.google.firebase:firebase-database:11.2.0'
    compile 'com.google.firebase:firebase-perf:11.2.0'
    compile 'com.firebaseui:firebase-ui-auth:2.0.1'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.android.support:design:26.0.2'
    compile 'com.github.bumptech.glide:glide:4.0.0'
    compile 'com.android.support:support-v4:26.0.2'
    compile 'com.android.support:multidex:1.0.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
    testCompile 'junit:junit:4.12'
}



apply plugin: 'com.google.gms.google-services'

我已经尝试过清理并重建项目,但似乎没有任何工作

2 个答案:

答案 0 :(得分:0)

将您的构建工具版本改为:

buildToolsVersion "26.0.2"

并从Facebook中排除Play服务,例如

compile ('com.facebook.android:facebook-android-sdk:[4,5)'){
    exclude group:"com.google.android.gms"
}

答案 1 :(得分:0)

好吧看起来真正有用的是替换

'com.google.android.gms:play-services-location:11.2.0'

'com.google.android.gms:play-services:11.2.0'