react-native build release android BUILD FAILED重复条目zza.class

时间:2016-11-15 06:35:07

标签: react-native

我的react-native应用程序使用react-native-fcm和react-native-maps,它在调试时运行良好但在汇编时发生失败

失败:构建因异常而失败。

  • 出了什么问题:
  

任务':app:transformClassesWithJarMergingForRelease'执行失败。    > com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / common / api / zza.class

我的android / app / build.gradle

compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.xxx.xxx"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
    multiDexEnabled true
}

dependencies {
    compile project(':react-native-maps')
    compile project(':react-native-fcm')
    compile project(':react-native-camera')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

和android / build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

请解决任何问题。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案:转到node_modules / react-native-maps / android / build.gradle并将版本编辑为:+及其工作:D

dependencies {
    compile 'com.facebook.react:react-native:+'
    compile "com.google.android.gms:play-services-base:+"
    compile 'com.google.android.gms:play-services-maps:+'
}