Proguard: proguard duplicate zip entry error when same libararies be referenced by more than 2 library projects.

2,851 views
Skip to first unread message

Eason Lee

unread,
Feb 24, 2014, 11:50:29 PM2/24/14
to adt...@googlegroups.com
Hi all gradle experts:

I've go another problem when doing gradle build with proguard.

Below is my project structure:
|---src/
|---libs
     |---android-support-v4.jar
     |---hello.jar
|---build.gradle
|---settings.gradle
|---library1(using android-libaray plugin)
       |---build.gradle
       |---libs
            |---android-support-v4.jar
            |---hello.jar

This all works fine without proguard, however, It will got the exception with proguard function.

The error message is looks like
* What went wrong:
Execution failed for task ':proguardRelease'.
> java.io.IOException: Can't write [/home/eason/xxxx/build/
classes-proguard/release/classes.jar] (Can't read [/home/eason/xxx/build/exploded-bundles/xxx.aar/libs/android-support-v4.jar(;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [android/support/v4/b/f.class == android-support-v4.jar:android/support/v4/util/MapCollections.class]))

BUILD FAILED

From one discussed topic here, I found I need to
1.remove android-support-v4.jar from libs folder
2.add dependency with "compile 'com.android.support:support-v4:13.0.0'" in build.gradle.

But my question is:
1.how can I do for hello.jar here becuase it will also be reference by outer app and library1?
2.Is there any flag can be set in build.gradle to prevent this situation?

Thanks a lot for all your help.

gauri...@gmail.com

unread,
Apr 25, 2016, 4:06:19 PM4/25/16
to adt-dev
I am facing same issue/problem in my android project.
Have you got any solution for this?
I am having my library say "xyz.jar" like your "hello.jar".
I have kept it in one directory which is placed in same directory where my project directory is present i.e. same hierarchy.
And I am giving relative path of this library (xyz.jar) in my two modules.
But still proguard is giving "Duplicate zip entry" error for any class present in library.
Sometimes it gives error "Unexpected end of ZLIB input stream" for any class present in library "xyz.jar".

Please help me.

Thanks,
Gauri.

Jayshil Dave

unread,
Apr 10, 2017, 9:53:21 AM4/10/17
to adt-dev
Similar problem for me as well.
i have 
AAR_1 with dependency
JAR_1
JAR_2
JAR_3

AAR_2 with dependency
JAR_1
JAR_2
JAR_3

Idea was to use AAR_1 in one project and AAR_2 in another.
Now in case i have to use both
AAR_1 and AAR_2 as dependency for my Project it fails on Proguard.
Any particular hints where i can manage this or it will never work.

I understand that JAR's might have different versions however, I have ensure they are same. But there is no way to version Jar so i cant use something like this as well
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:24.2.1'
}
}

Any hints to work with multiple AAR having same JAR dependencies?
Reply all
Reply to author
Forward
0 new messages