0

Getting this error after added the depandency compile 'com.longtailvideo.jwplayer:jwplayer-ima:+'

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/nanohttpd/mimetypes.properties File1: C:\Users\gauravkumar.singh.gradle\caches\modules-2\files-2.1\com.google.ads.interactivemedia.v3\interactivemedia\3.5.2\21246e1a6815dc499443d46f9f5dbe954fd2b746\interactivemedia-3.5.2.jar File2: C:\Users\gauravkumar.singh.android\build-cache\fe94083f69d19de3fbe36d97989e4bfe87efb104\output\jars\classes.jar

Ghn Demo
  • 21
  • 4

2 Answers2

0

try this it works in my case

Add below text on build.gradle file solve problem

packagingOptions {
    exclude  'jsr305_annotations/Jsr305_annotations.gwt.xml'
    exclude  'build-data.properties'
    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'
 }
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
  • Thanks @Nileash , Given a quick reply will add above code and update you soon it;s working or not – Ghn Demo Sep 06 '17 at 07:18
  • I have tried but not working.My error is Duplicate files copied in APK META-INF/nanohttpd/mimetypes.properties – Ghn Demo Sep 06 '17 at 07:27
  • @GhnDemo check this link https://stackoverflow.com/questions/27977396/android-studio-duplicate-files-copied-in-apk-meta-inf-dependencies-when-compile – AskNilesh Sep 06 '17 at 07:31
0

As the error message suggests you are not excluding the META-INF/LICENSE file which exists in more than one of your dependencies

packagingOptions {
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE'
     exclude 'META-INF/notice'
     exclude 'META-INF/notice.txt'
     exclude 'META-INF/license'
     exclude 'META-INF/license.txt'
}
Harshit Trivedi
  • 764
  • 9
  • 33
  • I have tried but not working.My error is Duplicate files copied in APK META-INF/nanohttpd/mimetypes.properties – Ghn Demo Sep 06 '17 at 07:28