sergii.gudym
sergii.gudym

Reputation: 173

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

Upvotes: 8

Views: 2226

Answers (2)

Lokesh Patel
Lokesh Patel

Reputation: 1162

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'

Upvotes: 15

Hamzeh Soboh
Hamzeh Soboh

Reputation: 7710

Adding this to your gradle file will solve your problem:

packagingOptions {
    exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
}

Upvotes: 4

Related Questions