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