0

I was developing an android app. Recently i removed activation.jar and mail.jar from my project and then added them back. After adding them back, while trying to run my application i'm receiving the below error:

Error:Execution failed for task 
':app:transformResourcesWithMergeJavaResForDebug'     
com.android.build.api.transform.TransformException: 
com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/mimetypes.default

File1: C:\Android\Workspace\WeekendMovieRating\app\libs\activation.jar
File2: C:\Android\Workspace\WeekendMovieRating\app\libs\mail.jar

I googled for solution and tried the below solution;

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/license.txt'
    exclude 'META-INF/dependencies.txt'
}

I added the above code in gradle.properties and tried to run the application but still receiving the same error.

And then i added below code after observing my error message:

exclude 'META-INF/mimetypes.default'
exclude 'META-INF/mailcap.default'

After adding the above lines it is showing as BUILD SUCCESSFULL but with 240 errors.

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.sun.mail.imap.DefaultFolder$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
...
...
... 
Error:indicate that it is *not* an inner class.
:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
:app:fullDebugBuildInfoGenerator
:app:assembleDebug
Information:BUILD SUCCESSFUL
Information:Total time: 1 mins 47.694 secs
Information:240 errors
Information:0 warnings

Please post your answer. Thanks in advance

2 Answers2

0

The error you're getting is Proguard-related and doesn't have anything to do with Duplicate Files issue you originally posted.

You should update your title and description accordingly to reflect that.

Unless you give more detailed information on the proguard issue, it's difficult to resolve.

You can have a look at this similar question to see what you need to add to your proguard config.

Community
  • 1
  • 1
Passer by
  • 562
  • 9
  • 14
  • What do you mean by `title` and `description` ? – Nimmagadda Gowtham Aug 21 '16 at 05:47
  • What should i `post` to give more information about `proguard issue` ? – Nimmagadda Gowtham Aug 21 '16 at 05:48
  • I'm just saying your original question is misleading, so I was suggesting you edit the original question with regards to Proguard rather than META-INF. As well as add the appropriate tags to get better exposure. – Passer by Aug 21 '16 at 13:42
  • You should post the full "240 proguard errors" here as a public github gist/pastebin. So we can get better context on the issue. I think if you don't know what proguard/or not interested in keeping it. You can simply disable it. – Passer by Aug 21 '16 at 13:45
  • I deleted the `activation.jar` and `mail.jar`and then added new `activation.jar` and `mail.jar`. Adding `new jars` created the issue. I removed the `newly added jars` and added the `back up jars` which i removed first. This solved the issue. – Nimmagadda Gowtham Aug 28 '16 at 05:53
0
packagingOptions {
    pickFirst 'META-INF/mailcap.default'

    pickFirst 'META-INF/LICENSE.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/mimetypes.default'
    exclude 'META-INF/mailcap.default'
}

use this for packaging option

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96