在Android Studio中无法构建APK文件

3

我想构建apk,但无法创建。出现以下错误。但项目运行成功。我的android studio 版本是2.2.2

错误:执行任务失败:':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zzd.class

我的gradle文件如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.wedding.weddingapp"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        configurations { all*.exclude module: 'gson-2.5' }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    maven { url "https://raw.githubusercontent.com/layerhq/releases-android/master/releases/" }
    maven { url "https://raw.githubusercontent.com/layerhq/Atlas-Android/master/releases/" }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:multidex:1.0.0'
    compile 'com.layer.atlas:layer-atlas:0.3.6'
    compile 'com.google.firebase:firebase-messaging:9.8.0'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.android.support:cardview-v7:25.1.0'


    testCompile 'junit:junit:4.12'
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
1个回答

1

您正在遇到以下问题:

TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zzd.class

您应该使用最新版本的Firebase

 compile 'com.google.firebase:firebase-messaging:10.0.1'

和使用

 buildToolsVersion "25.0.1"

请清理、重建并重新启动您的IDE。

1
实际上,我的同事正在处理代码,她能够构建APK文件,而我自己无法构建。 - m.v.n.kalyani
1
在我调用的地方,我没有找到。你能帮忙吗? - m.v.n.kalyani
1
compile 'com.android.support:multidex:1.0.0' compile 'com.layer.atlas:layer-atlas:0.3.6' compile 'com.google.firebase:firebase-messaging:9.8.0' compile 'com.android.support:appcompat-v7:25.1.0' compile 'com.android.support:design:25.1.0' compile 'com.android.volley:volley:1.0.0' compile 'de.hdodenhof:circleimageview:2.1.0' compile 'com.android.support:support-v4:25.1.0' compile 'com.facebook.android:facebook-android-sdk:4.+' compile 'com.android.support:cardview-v7:25.1.0' - m.v.n.kalyani
1
我已经做了1000次。好的,根据您的建议,我现在会去做。 - m.v.n.kalyani
1
让我们在聊天中继续这个讨论 - m.v.n.kalyani
显示剩余3条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接