Ethan
Ethan

Reputation: 51

AndroidStudio Gradle build ProGuard Duplicate zip entry Error

What went wrong:

Execution failed for task ':proguardRelease'.
java.io.IOException: Can't write [C:\Workspaces\Eclipse\Mixvid\build\intermedi
ates\classes-proguard\release\classes.jar] (Can't read [C:\Workspaces\Eclipse\Mi
xvid\build\intermediates\exploded-aar\Mixvid\meituPic_andcommonlib\unspecified\l
ibs\httpmime-4.2.2.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [httpm
ime-4.2.2.jar:org/apache/http/entity/mime/content/ByteArrayBody.class]))

I can't delete this duplicate jar because my library needs it, is there any method to solve this?

Upvotes: 3

Views: 1803

Answers (2)

arsent
arsent

Reputation: 7193

You can use gradle packageOptions to exclude a class that has a duplicate.

android {

    ...

    packagingOptions {
        exclude  'org/apache/http/entity/mime/content/ByteArrayBody.class'
    }

    ...

}

Upvotes: 2

Allen
Allen

Reputation: 6882

I got this issue today, and found that I have two different versions of one same library:

enter image description here

enter image description here

Just remove one then solved issue.

Upvotes: 0

Related Questions