无法在Android Studio中构建apk文件

时间:2017-02-07 10:31:58

标签: android android-studio

我正在尝试构建apk但我无法创建它。获取以下错误。但项目运行成功。我的android工作室版本2.2.2

  

错误:任务执行失败   ':应用程序:transformClassesWithJarMergingForDebug&#39 ;. >   com.android.build.api.transform.TransformException:   java.util.zip.ZipException:重复条目:   COM /谷歌/机器人/克/普通/ 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 个答案:

答案 0 :(得分:1)

你要

  

TransformException:java.util.zip.ZipException:重复条目:   COM /谷歌/机器人/克/普通/ API / zzd.class

您应该使用 Firebase

的最新版本
 compile 'com.google.firebase:firebase-messaging:10.0.1'

并使用

 buildToolsVersion "25.0.1"

Thean 清理 - 重建 - 重新启动您的IDE