【发布时间】:2015-11-19 17:57:33
【问题描述】:
我正在尝试在我的应用程序中使用 guava 库。但我也在使用来自 github 的 chromium_webview 项目。这个 webview 项目包含 guava 库。
我收到以下错误:
错误:任务执行失败 ':app:packageAllDebugClassesForMultiDex'。 java.util.zip.ZipException: 重复条目:com/google/common/annotations/GwtIncompatible.class
我已经查看了 this 和 this 的答案,但似乎没有任何效果。
这是我模块的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my.package.name"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "2048M"
jumboMode = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile files('libs/svgAndroid2-3Jan2014.jar')
compile project(':chromium_webview')
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.guava:guava:18.0'
}
我在chromium_webview 项目上尝试过这样的排除方法:
compile (project(':chromium_webview')) {
exclude group: 'com.google.guava', module: "guava_javalib.jar"
}
像这样:
compile (project(':chromium_webview')) {
exclude module: "guava_javalib.jar"
}
我不能再次使用同一个库吗?
有没有办法为两个模块使用相同的库?
// ======================== 编辑:
就像@petey 提到的评论一样,我尝试从我的模块中只删除 guava 库,而我的模块没有读取另一个模块中的库。
compile 'com.google.guava:guava:18.0'
那是我尝试删除的行。
任何想法都将不胜感激。
谢谢!!
【问题讨论】:
-
你不能删除
compile 'com.google.guava:guava:18.0'吗?因为它已经是 chromium_webview 依赖项的一部分? -
我试过了。当我构建它时,我的模块(应用程序)找不到库
-
您解决了这个问题吗?我有同样的问题
标签: android android-studio android-gradle-plugin android-guava