zip.ZipException:重复条目:annotations/Beta.class [英] zip.ZipException: duplicate entry: annotations/Beta.class
问题描述
我已经花了一天多的时间来解决运行我的android项目时给出的重复项.
I have been struggling for more that a day to fix the duplicate entry given when running my android project.
错误:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.> java.util.zip.ZipException: duplicate entry: com/google/common/annotations/Beta.class
我试图排除各种模块并启用multiDex,但遇到了麻烦,请帮助我解决此问题:
I've tried to exclude various modules as well as enable multiDex, and have hit a wall, please help me solve this problem:
部分代码:
compile(project(path: ':k_endpoint', configuration: 'android-endpoints')) {
exclude(group: 'com.google.guava', module: 'guava-jdk5')
exclude(group: 'com.android.support', module: 'support-annotations')
}
compile ('com.android.support:multidex:1.0.1')
compile ('com.android.support:appcompat-v7:22.2.0')
compile ('com.google.android.gms:play-services:8.1.0')
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile ('com.android.support:cardview-v7:22.2.0')
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
我已经在recyclerview和cardview上尝试了排除支持注释",因为两者似乎都具有该模块,但无济于事.
I have tried the exclude 'support annotations' at the recyclerview and cardview, because both seem to have the module, but doesn't help in any way.
端点代码:
dependencies {
compile 'com.google.guava:guava-jdk5:17.0'
appengineSdk ('com.google.appengine:appengine-java-sdk:1.9.19'){
}
compile ('com.google.appengine:appengine-endpoints:1.9.19')
compile ('com.google.appengine:appengine-endpoints-deps:1.9.19')
compile ('javax.servlet:servlet-api:2.5')
compile ('com.googlecode.objectify:objectify:5.1.1')
compile ('com.ganyo:gcm-server:1.0.2')
compile ('com.sendgrid:sendgrid-java:2.2.1'){
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
exclude(group: 'org.json', module: 'json')
}
我试图与下面找到冲突,不确定注解是否是首先要搜索的正确模块.
I tried to find the conflicts with below, not sure if annotations is the correct module to search for in the first place.
./gradlew -q :app:dependencyInsight --dependency annotations --configuration compile
结果:
+--- com.android.support:recyclerview-v7:22.2.0
| \--- compile
\--- com.android.support:support-v4:22.2.0
+--- com.android.support:appcompat-v7:22.2.0
| +--- compile
| +--- com.android.support:design:22.2.0
| | \--- compile
| \--- com.android.support:mediarouter-v7:22.2.0
| \--- com.google.android.gms:play-services-cast:8.1.0
| \--- com.google.android.gms:play-services:8.1.0
| \--- compile
+--- com.android.support:design:22.2.0 (*)
+--- com.android.support:recyclerview-v7:22.2.0 (*)
\--- com.google.android.gms:play-services-basement:8.1.0
+--- com.google.android.gms:play-services:8.1.0 (*)
+--- com.google.android.gms:play-services-ads:8.1.0
etc
推荐答案
为了系统地解决"ZipException:重复输入"错误,请查看我的答案
In order to systematically resolve "ZipException: duplicate entry" errors check out my answer here. If you do not use multidex, just ignore the multidex part. I encountered the exact same error regarding Beta.class and resolved it by excluding all occurences of guava:
compile ('com.google.dagger:dagger:2.4') {
exclude group: 'com.google.guava'
}
compile ('com.google.dagger:dagger:2.4') {
exclude group: 'com.google.guava'
}
这篇关于zip.ZipException:重复条目:annotations/Beta.class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!