1

I upgraded today Android Studio installation on a Linux Mint 18 machine at version 2.2 and I imported successfully my project in the new installation, however I can not run my app since I get the error message:

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/LICENSE File1: /home/epdiamantopoulos/StudioProjects/Educational Difthera Trial Version/app/libs/httpcore-4.0.1.jar File2: /home/epdiamantopoulos/StudioProjects/Educational Difthera Trial Version/app/libs/commons-logging-1.1.1.jar

After looking at many similar posts I understood that this situation seems to be a common problem for many that appears with many variations and I tried many of the suggested solutions provided but with no luck (par example https://stackoverflow.com/questions/34031395/errorexecution-failed-for-task-apptransformresourceswithmergejavaresfordebughttps://stackoverflow.com/questions/34031395/errorexecution-failed-for-task-apptransformresourceswithmergejavaresfordebug).

I guess that the upgraded Android Studio is the key but I can not figure out what to do, thus I would appreciate any suggestions!

Community
  • 1
  • 1
Epaminondas
  • 818
  • 9
  • 14

1 Answers1

0

Add this exclude statement to your build.gradle:

packagingOptions {
    exclude 'META-INF/LICENSE'
}

Here is what mine looks like.

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "sound.staxx.big.soundpriority"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
    }
}

Hope it helps!

  • Thank you for your answer. I already tried this suggestion and the outcome is rather strange since the app run on a virtual machine but not correctly (seems not to load correctly default values) and crashes with no reason in normal usage. – Epaminondas Oct 02 '16 at 08:50