zip.ZipException:重复条目:annotations/Beta.class
zip.ZipException: duplicate entry: annotations/Beta.class
我花了一天多的时间来修复 运行 我的 android 项目时给出的重复条目。
错误:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.> java.util.zip.ZipException: duplicate entry: com/google/common/annotations/Beta.class
我试过排除各种模块以及启用multiDex,都碰壁了,请帮我解决这个问题:
部分代码:
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 上尝试排除 'support annotations',因为它们似乎都有模块,但没有任何帮助。
端点代码:
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')
}
我试图找到与下面的冲突,不确定注释是否是首先要搜索的正确模块。
./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: duplicate entry" 错误,请查看我的回答 here。如果不使用multidex,直接忽略multidex部分即可。我遇到了关于 Beta.class 的完全相同的错误,并通过排除所有出现的番石榴来解决它:
compile ('com.google.dagger:dagger:2.4') {
exclude group: 'com.google.guava'
}
我花了一天多的时间来修复 运行 我的 android 项目时给出的重复条目。
错误:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.> java.util.zip.ZipException: duplicate entry: com/google/common/annotations/Beta.class
我试过排除各种模块以及启用multiDex,都碰壁了,请帮我解决这个问题:
部分代码:
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 上尝试排除 'support annotations',因为它们似乎都有模块,但没有任何帮助。
端点代码:
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')
}
我试图找到与下面的冲突,不确定注释是否是首先要搜索的正确模块。
./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: duplicate entry" 错误,请查看我的回答 here。如果不使用multidex,直接忽略multidex部分即可。我遇到了关于 Beta.class 的完全相同的错误,并通过排除所有出现的番石榴来解决它:
compile ('com.google.dagger:dagger:2.4') {
exclude group: 'com.google.guava'
}