Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Proguard build Duplicate Zip

In my android application i have multiple third party libraries in libs folder

ex -: httpcore-4.2.4.jar , httpmime-4.2.5.jar,twitter4j-core-4.0.1.jar

these libraries are not duplicated and i'm pretty sure with that , but when i create the proguard release i get this error

(Duplicate zip entry [twitter4j-core-4.0.1.jar:META-INF/MANIFEST.MF])
.... (This error occurs for all of the library(libs)

I refereed this link to overcome with issue , i tried every option of it , but no luck with that ,

Proguard warnings "can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry)"

Is there any way to specify filters on the input jar

like image 634
Mr.G Avatar asked Oct 24 '14 05:10

Mr.G


1 Answers

Your libraries are not duplicated, but some info files inside of several libraries are.

The best solution is to include in your build.gradle. inside the "android" section something like this:

android{
 packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LGPL2.1'

    }
}

By the error message that you included here I will guess that adding this exclude will solve your problem:

exclude "META-INF/MANIFEST.MF"
like image 142
Martin Revert Avatar answered Oct 18 '22 07:10

Martin Revert