获取错误“重复条目:com / google / android / gms / internal / zzble.class”当试图添加一个包 [英] Getting the error "duplicate entry: com/google/android/gms/internal/zzble.class" when trying to add a package

查看:592
本文介绍了获取错误“重复条目:com / google / android / gms / internal / zzble.class”当试图添加一个包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 react-native-firestack 包添加到我的应用中。但它一直给出以下错误:

 :app:mergeDebugResources UP-TO-DATE 
:app:recordFilesBeforeBundleCommandDebug
:app:bundleDebugJsAndAssets SKIPPED
:app:generateBundledResourcesHashDebug
4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-D-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithJarMergingForDebug失败

失败:生成失败,出现异常。

*出错:
任务':app:transformClassesWithJarMergingForDebug'的执行失败。
> com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / internal / zzble.class

*尝试:
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。

构建失败

总时间:2.498秒
无法在设备上安装应用程序,请阅读上面的错误以了解详细信息。
确保您有一个Android模拟器正在运行或连接了一个设备,并有
设置您的Android开发环境。
转到https://facebook.github.io/react-native/docs/getting-started.html
并查看Android标签获取设置说明。

我试着添加一些包到 exclude group 在几个包。但没有人工作。这是 ./ gradlew clean:app:dependencies 结果: https://gist.github.com/THPubs/8fe8b4b9c80e3c6cd49541d66887c742 试图遵循其他类似的堆栈溢出问题,但看起来像这个软件包有很多依赖关系。我无法找到冲突。



我的 build.gradle 依赖项:



编译项目(':react-native-onesignal ')
编译项目(':react-native-fbsdk')
编译项目(':react-native-share')
编译项目(':react-native-video')
编译项目(':react-native-uuid-generator')
编译项目(':react-native-udp')
编译项目(':react-native-tcp')
编译项目(':react-native-camera')
编译项目(':react-native-contacts')
编译项目(':react-native-linear-gradient')
编译项目(':react-native-vector-icons')
编译fileTree(dir:libs,include:[* .jar])
compilecom.android .support:appcompat-v7:23.0.1
compilecom.facebook.react:react-native:+//从node_modules
compi le project(':react-native-image-picker')
compile(project:react-native-google-signin)){
exclude group:com.google.android.gms //非常重要
}
编译'com.google.android.gms:play-services-auth:10.2.0'
编译'com.google.firebase:firebase-crash: 10.0.1'
}


解决方案

您在所有的Google Play服务库中使用相同的版本:
例如:

  compilecom.google。 firebase-core:$ project.ext.googlePlayServicesVersion
compilecom.google.firebase:firebase-auth:$ project.ext.googlePlayServicesVersion
compilecom.google.firebase:firebase-数据库:$ project.ext.googlePlayServicesVersion

project.ext {
googlePlayServicesVersion = '10 .2.0'
}


I'm trying to add the react-native-firestack package to my app. But it keeps giving the following error :

:app:mergeDebugResources UP-TO-DATE
:app:recordFilesBeforeBundleCommandDebug
:app:bundleDebugJsAndAssets SKIPPED
:app:generateBundledResourcesHashDebug
4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzble.class

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.498 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment.
Go to https://facebook.github.io/react-native/docs/getting-started.html
and check the Android tab for setup instructions.

I tried to add some packages to exclude group in several packages. But none worked. Here's the ./gradlew clean :app:dependencies result: https://gist.github.com/THPubs/8fe8b4b9c80e3c6cd49541d66887c742

Tried to follow other similar stack overflow question but looks like this package has a lot of dependencies. I was unable to find the conflict.

My build.gradle dependencies:

dependencies {
    compile(project(":react-native-firestack"))
    compile project(':react-native-onesignal')
    compile project(':react-native-fbsdk')
    compile project(':react-native-share')
    compile project(':react-native-video')
    compile project(':react-native-uuid-generator')
    compile project(':react-native-udp')
    compile project(':react-native-tcp')
    compile project(':react-native-camera')
    compile project(':react-native-contacts')
    compile project(':react-native-linear-gradient')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-image-picker')
    compile(project(":react-native-google-signin")){
    exclude group: "com.google.android.gms" // very important
    }
    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.google.firebase:firebase-crash:10.0.1'
}

解决方案

Make sure you use the same version in all your google play services libs: For example :

     compile "com.google.firebase:firebase-core:$project.ext.googlePlayServicesVersion"
        compile "com.google.firebase:firebase-auth:$project.ext.googlePlayServicesVersion"
        compile "com.google.firebase:firebase-database:$project.ext.googlePlayServicesVersion"

    project.ext {
        googlePlayServicesVersion = '10.2.0'
}

这篇关于获取错误“重复条目:com / google / android / gms / internal / zzble.class”当试图添加一个包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆