构建apk时出现(android)错误:

时间:2017-01-15 16:27:21

标签: android

Logcat错误:

: Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.clas

gradle app code ::

apply plugin: 'com.android.application'

android {

    compileSdkVersion 24
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.example.esrae.rainbow"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v7'
    }

}

dependencies {

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:support-v7:24.2.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.firebaseui:firebase-ui:0.4.4'
}

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

2 个答案:

答案 0 :(得分:0)

确保您的依赖项中的所有版本都是相同的版本,请使用它来代替您的依赖项。

compile 'com.android.support:support-v7:24.2.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.firebaseui:firebase-ui:1.1.1'

在您的代码中,您正在使用

compile 'com.firebaseui:firebase-ui:0.4.4'

将此更改为

compile 'com.firebaseui:firebase-ui:10.0.1'

在你的Projects的gradle中使用它。

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }


    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

答案 1 :(得分:0)

在终端执行根项目文件夹中:

./gradlew clean