Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 210
sergii.gudym Avatar asked Jun 03 '16 13:06

sergii.gudym


2 Answers

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'
like image 105
Lokesh Patel Avatar answered Oct 21 '22 17:10

Lokesh Patel


Adding this to your gradle file will solve your problem:

packagingOptions {
    exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
}
like image 4
Hamzeh Soboh Avatar answered Oct 21 '22 16:10

Hamzeh Soboh