Gradle重复条目 [英] Gradle Duplicate Entry
本文介绍了Gradle重复条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将Digits mobile sdk集成到我的项目中,并且不会再构建。它与我正在使用的gson库有某种冲突。在构建过程中出现此错误:
I integrated the Digits mobile sdk into my project and it wouldn't build anymore. It has some kind of a clash with gson library that i am using. I get this error during the build:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/gson/Gson$5.class
这是我的build.gradle
this is my build.gradle
buildscript {
repositories {maven { url 'https://maven.fabric.io/public' }}
dependencies {classpath 'io.fabric.tools:gradle:1.+'}}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {...}
buildTypes {release {...}}
dexOptions {preDexLibraries = false
incremental true
javaMaxHeapSize "4g"}
packagingOptions {...}}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }}
dependencies {
...
compile('com.crashlytics.sdk.android:crashlytics:2.2.4@aar') {
transitive = true;}
compile 'io.branch.sdk.android:library:1.5.5'
compile('com.digits.sdk.android:digits:1.5.0@aar') {
transitive = true;}}
推荐答案
这是解决方案
this is the solution
compile('com.digits.sdk.android:digits:1.5.0@aar') {
transitive = true;
exclude module: 'gson';
}
您需要添加排除模块:'gson'
you need to add exclude module: 'gson'
这篇关于Gradle重复条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文