4

I get "Duplicate zip entry error" when using minifyEnabled.

Version of Android Studio : 1.0 rc 1
OS version: Mac OS 10.9.5
Java JRE/JDK version: "1.7.0_71"
Gradle: 0.14.0

Here are some of my build.gradle settings.

compileSdkVersion 21
buildToolsVersion "21.1.1"

packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/MANIFEST.MF'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
}

buildTypes {
    release {
        minifyEnabled true
        //proguardFile file('proguard-project.txt')
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
    debug {
        minifyEnabled true
        //proguardFile file('proguard-project.txt')
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        debuggable true 
        applicationIdSuffix = '.alpha' 
        versionNameSuffix = 'a'
    }
}
dependencies {
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.2'
compile project(':modules:Aviary-SDK')
compile project(':modules:facebook')
compile ('com.crashlytics.android:crashlytics:1.+'){
    exclude group: 'commons-io', module: 'commons-io'  //added this because crashlytics seems to be using commons-io
}
compile 'com.google.android.gms:play-services:6.1.11'
compile 'org.apache.httpcomponents:httpcore:4.3.2'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
}

I get this error message when I assembleDebug:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:proguardDebug'.
> java.io.IOException: Can't write [/Users/tomoaki/Workspace/temp/someproject/app/build/intermediates/classes-proguard/debug/classes.jar] (Can't read [/Users/tomoaki/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-io/1.3.2/b6dde38349ba9bb5e6ea6320531eae969985dae5/commons-io-1.3.2.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [commons-io-1.3.2.jar:org/apache/commons/io/CopyUtils.class]))

I read this question but the answers didn't work for me. Any help is appreciated.

Community
  • 1
  • 1
tomoima525
  • 832
  • 10
  • 13
  • 1
    Can you run "gradlew ::dependencies". Replace "" with the name of your app module. It looks like "commons-io" appears in a few other libraries besides "crashlytics" and you may need to exclude it. Please post the results. Thanks. – AndroidGuy Nov 25 '14 at 03:57
  • @AndroidGuy Thanks for help! I ran the command and I put it in [gist](https://gist.github.com/tomoima525/97eaf11e59698b57afe6). Looks like Aviary has "commons-io". I tried: compile project(':modules:Aviary-SDK'){ exclude group: 'commons-io', module: 'commons-io' } but it didn't work. I got an error Gradle DSL method not found: exclude() – tomoima525 Nov 25 '14 at 07:18
  • loosely related, but same trick worked: i ran into the same issue, where o.a.c commons-io seems to depend on something called 'commons-io:commons-io'... it is a tricky thing to notice because it seems innocuous given that they have the same name, but its a transitive dependency which can cause dupe errors – jayunit100 Mar 11 '15 at 03:27

1 Answers1

0

Since you found it is in Aviary as well, you could try:

compile (project(':modules:Aviary-SDK')) { exclude group: 'commons-io', module: 'commons-io' }

This way you won't get the DSL error.

mennovogel
  • 339
  • 1
  • 2
  • 9
  • Thanks for the comment.Yeah, it worked! I didn't put () to project(':modules:Aviary-SDK'), and that's why it wasn' working. Thanks a lot! – tomoima525 Nov 25 '14 at 10:05