【问题标题】:android:Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'android:错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败
【发布时间】:2017-09-04 03:23:24
【问题描述】:

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

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

这是我的 gradle 文件 应用插件:'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'

我已经尝试清理和重建项目,但似乎没有任何效果

【问题讨论】:

    标签: android


    【解决方案1】:

    好吧,似乎真正起作用的是替换

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

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

    【讨论】:

    • 如果你想要的只是位置包,那就编译太多库了
    • 我知道,但这是目前唯一有效的解决方案。所以我会坚持下去,直到我弄清楚这一点。此外,当我使用位置库时,我会收到有关与该库的先前版本冲突的警告。我想我必须删除旧的,所以我会试试
    • 我认为其他库之一依赖于旧版本的播放服务。您可以使用该链接查找哪个链接,然后将其排除,正如另一个答案所说
    【解决方案2】:

    将您的构建工具版本提升到:

    buildToolsVersion "26.0.2"
    

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

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

    【讨论】:

    • 我将我的构建更新为“26.0.1”,但仍然无法正常工作。我认为没有“26.0.2”
    • 这也不起作用实际起作用的是将 'com.google.android.gms:play-services-location:11.2.0' 替换为 'com.google.android.gms:play-服务:11.2.0'
    猜你喜欢
    • 2016-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-18
    相关资源
    最近更新 更多