-6

When I applied proguard, then in console ,getting below error.please solve my issue.

solve duplicate zip entry error while applying progaurd.

Console Error:

Note: there were 157 duplicate class definitions.

      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-io-2.4.jar:META-INF/LICENSE.txt])
Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [httpmime-4.2.1.jar:META-INF/NOTICE.txt])
Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [httpmime-4.2.1.jar:META-INF/LICENSE.txt])

Anyone help me regarding this proguard problem? I have searched a lot in google, but still can't find any proper solution. Thanks in advance.

Narendra Singh
  • 3,990
  • 5
  • 37
  • 78
dipali
  • 10,966
  • 5
  • 25
  • 51
  • The link before your warning explains your problem pretty straight forward... http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass – Nir Alfasi Jun 10 '15 at 05:30
  • @alfasin i have read it.but in this doc,i don't getting any solution. – dipali Jun 10 '15 at 05:33
  • The solution is stated explicitly: filter out these resources from the included jars. In regards to "how to" do it, it depends on how you're building your project, rekire shows you below how to do it using Gradle. [Here](https://maven.apache.org/plugins/maven-assembly-plugin/examples/single/filtering-some-distribution-files.html) is a maven example, and if you're using anything else - it shouldn't be difficult to google it. Voting to close the question. – Nir Alfasi Jun 10 '15 at 06:04
  • possible duplicate of: http://stackoverflow.com/questions/10397717/ant-task-to-filter-jars-for-zip-file-and-manifest – Nir Alfasi Jun 10 '15 at 06:05

1 Answers1

2

Since you don't write the details I expect that you are using Android Studio and Gradle as build system. Add to your android DSL this block:

packagingOptions {
    exclude '.readme'
    exclude 'LICENSE.txt'
    exclude 'README.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE.txt'
}

You do not need all of them but it will work. This basically blocks the build system to include some files. In your case some useless text files.

rekire
  • 47,260
  • 30
  • 167
  • 264