Manmohan Pal
Manmohan Pal

Reputation: 1577

Duplicate files copied in APK error_prone/Annotations.gwt.xml in interactivemedia

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDevDebug'.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK error_prone/Annotations.gwt.xml File1: /Users/manmohansingh/.android/build-cache/c5c673e638724b8a150c9a07f761f05b8fef0253/output/jars/classes.jar File2: /Users/manmohansingh/.gradle/caches/modules-2/files-2.1/com.google.ads.interactivemedia.v3/interactivemedia/3.6.0/76bc1544c67335c4bb38631001fd05a3e70004e4/interactivemedia-3.6.0.jar

Upvotes: 7

Views: 3930

Answers (2)

vkozhemi
vkozhemi

Reputation: 411

Here are few methods to solve this problem:

  1. Android Studio -> Build -> Clean project

  2. Android Studio -> File -> Invalidate Caches / Restart ...

  3. Need to add exclude in build.gradle file in android {} section:

     packagingOptions {
         exclude 'error_prone/Annotations.gwt.xml'
         exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
         exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
    

    }

Upvotes: 0

Manmohan Pal
Manmohan Pal

Reputation: 1577

After struggling of three hours got this solution: Add these lines into

packagingOptions {
    exclude 'error_prone/Annotations.gwt.xml'
    exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
    exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
}

FINAL :

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'
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/rxjava.properties'

    exclude 'error_prone/Annotations.gwt.xml'
    exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
    exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
}

Upvotes: 19

Related Questions