【问题标题】:react-native build release android BUILD FAILED duplicate entry zza.classreact-native build release android BUILD FAILED 重复条目 zza.class
【发布时间】:2016-11-15 06:35:07
【问题描述】:

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

FAILURE:构建失败并出现异常。

  • 出了什么问题:

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

我的安卓/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'
    }
}

请提供任何解决方案。

【问题讨论】:

  • react-native-fcm 和 react-native-maps 都使用 play-service 9.4.0 我尝试添加 compile 'com.google.android.gms:play-services-maps:9.4.0 ' 到依赖项,但它不起作用:(

标签: react-native


【解决方案1】:

我找到了解决方案:转到 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:+'
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-22
    • 2022-08-15
    • 2017-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多