0
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForLocalDebug'.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/DEPENDENCIES File1: /home/solulab/.gradle/caches/modules-2/files-2.1/org.apache.james/apache-mime4j-dom/0.7.2/1c289aa264548a0a1f1b43685a9cb2ab23f67287/apache-mime4j-dom-0.7.2.jar File2: /home/solulab/.gradle/caches/modules-2/files-2.1/org.apache.james/apache-mime4j-core/0.7.2/a81264fe0265ebe8fd1d8128aad06dc320de6eef/apache-mime4j-core-0.7.2.jar

Max
  • 510
  • 5
  • 16
  • 1
    try to exclude that jar – Madhur Jun 23 '16 at 05:24
  • @Madhur i tried that but then app crashes on startup, seems it also excludes some other imp stuff, so can you please help me with the exclude statement for these particular jars – Max Jun 23 '16 at 05:27
  • 1
    check this out http://stackoverflow.com/questions/33923461/how-do-i-resolve-duplicate-files-copied-in-apk-meta-inf http://stackoverflow.com/questions/20673625/android-gradle-plugin-0-7-0-duplicate-files-during-packaging-of-apk http://stackoverflow.com/questions/20673888/duplicate-files-copied-android-studio-0-4-0 – Madhur Jun 23 '16 at 10:08
  • 1
    @Madhur thanks for the time, yes i have tried all of them, the thing here is that i cant just add exclude 'META-INF/DEPENDENCIES' as it will exclude all the dependencies, which breaks the apk, i am looking for a statement which will only exclude this :apache-mime4j-core-0.7.2.jar or/and apache-mime4j-dom-0.7.2.jar, so thats where I am stuck – Max Jun 23 '16 at 10:16
  • 1
    Try to add `packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' }` in your build.gradle – pRaNaY Jun 23 '16 at 10:20
  • compile project (':projectname') { exclude module: 'org.apache.james' } – Madhur Jun 23 '16 at 10:23
  • 1
    one more solution: `sourceSets { main { java { exclude 'com/ourcompany/someotherpackage/polling/**' } } }` – Madhur Jun 23 '16 at 10:34
  • Did you find a solution for this problem? – Sarah May 13 '17 at 20:03

0 Answers0