I have been struggling for more that a day to fix the duplicate entry given when running my android project.
Error:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.> java.util.zip.ZipException: duplicate entry: com/google/common/annotations/Beta.class
I've tried to exclude various modules as well as enable multiDex, and have hit a wall, please help me solve this problem:
part of code:
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'
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.
The endpoint code:
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
Results:
+--- 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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…