Duplicate files copied in APK META-INF/LICENSE - android

Error:Execution failed for task ':openpayandroid:transformResourcesWithMergeJavaResForRelease'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: /Users/ederpadilla/Downloads/driveappuble-drive-android-484430cd00e7/openpayandroid/libs/jackson-core-2.8.2.jar
File2: /Users/ederpadilla/Downloads/driveappuble-drive-android-484430cd00e7/openpayandroid/libs/jackson-core-asl-1.9.11.jar

Add this code in your app gradle file
android {
...
packagingOptions {
exclude 'META-INF/LICENSE'
}
}

Related

Android Duplicate File Exception

I have downloaded the Jackson2 libraries to include in an android class. I get this error upon building:
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/LICENSE File1: \app\libs\jackson-core-2.9.1.jar File2: \app\libs\jackson-databind-2.9.1.jar File3: \app\libs\jackson-annotations-2.9.1.jar
I searched the internet and found this to be the most common answer:
packagingOptions {
exclude "META-INF/license.txt"
}
However, this doesn't fix the issue above.
You need to exclude the exact file name. From the error log, you can see that the duplicated file is META-INF/LICENSE (be aware of the case-sensitive) :
Duplicate files copied in APK META-INF/LICENSE
So, exclude it:
packagingOptions {
exclude 'META-INF/LICENSE'
}

DuplicateFileException: Duplicate files copied in APK project.properties [duplicate]

I'm getting below mentioned error when I'm trying to run my application.
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForAmazonCheezCoverage'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup/otto/pom.xml
File1: /Users/afourtest/.gradle/caches/modules-2/files-2.1/com.crashlytics.android/crashlytics/1.1.13/e821eafa1bf489a26bdb71f95078c26785b37a1/crashlytics-1.1.13.jar
File2: /Users/afourtest/.gradle/caches/modules-2/files-2.1/com.squareup/otto/1.3.7/69d90fd7fb70e54746e26c10454c220e40a775ce/otto-1.3.7.jar
My app build.gradle is here
Add to build.gradle:
android {
...
packagingOptions {
exclude 'META-INF/maven/com.squareup/otto/pom.xml'
}
Also, instead of exclude you could use pickFirst

Error:Execution failed for task

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/LICENSE File1:
C:\Users\Jithin-PC.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.2.2\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\jackson-core-2.2.2.jar
File2:
C:\Users\Jithin-PC.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.2.2\3c8f6018eaa72d43b261181e801e6f8676c16ef6\jackson-databind-2.2.2.jar
File3:
C:\Users\Jithin-PC.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.2.2\285cb9c666f0f0f3dd8a1be04e1f457eb7b15113\jackson-annotations-2.2.2.jar
Before updating of Android studio to 2.2 it works well. pls help me..
I also faced the same issue a couple of days ago.
This is not a proper solution but more of a hack.
android {
packagingOptions {
// exclude 'META-INF/LICENSE.txt'
// exclude 'META-INF/LICENSE'
// exclude 'META-INF/license.txt'
pickFirst 'META-INF/LICENSE'
}
}
Try it.

DuplicateFileException m4b + play services 9.0

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResFor'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK jsr305_annotations/Jsr305_annotations.gwt.xml
File1:\app\build\intermediates\exploded-aar\google-maps-sdk-m4b\jars\classes.jar
File2:\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\9.0.0\jars\classes.jar
Add below text in build.gradle inside the android{} section to solve the problem.
android {
...
packagingOptions {
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
exclude 'build-data.properties'
}
...
}
If getting more error DuplicateFileException add file with exclude.
Like :
Error
Duplicate files copied in APK jsr305_annotations/Jsr305_annotations.gwt.xml
Solution
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
Adding this to your gradle file will solve your problem:
packagingOptions {
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
}

Duplicate files copied in APK META-INF/maven/com.squareup/otto/pom.xml

I'm getting below mentioned error when I'm trying to run my application.
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForAmazonCheezCoverage'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup/otto/pom.xml
File1: /Users/afourtest/.gradle/caches/modules-2/files-2.1/com.crashlytics.android/crashlytics/1.1.13/e821eafa1bf489a26bdb71f95078c26785b37a1/crashlytics-1.1.13.jar
File2: /Users/afourtest/.gradle/caches/modules-2/files-2.1/com.squareup/otto/1.3.7/69d90fd7fb70e54746e26c10454c220e40a775ce/otto-1.3.7.jar
My app build.gradle is here
Add to build.gradle:
android {
...
packagingOptions {
exclude 'META-INF/maven/com.squareup/otto/pom.xml'
}
Also, instead of exclude you could use pickFirst

Categories

Resources