zip.ZipException:重复条目:annotations / Beta.class

时间:2015-11-02 07:27:47

标签: android android-gradle build.gradle

我一直在努力争取修复运行我的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上尝试了排除'支持注释',因为两者似乎都有模块,但没有任何帮助。

端点代码:

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

1 个答案:

答案 0 :(得分:2)

为了系统地解决" ZipException:重复输入"错误检查我的回答here。如果您不使用multidex,只需忽略multidex部分。我遇到了关于Beta.class的完全相同的错误,并通过排除所有出现的番石榴来解决它:

compile ('com.google.dagger:dagger:2.4') { exclude group: 'com.google.guava' }