user3278732
user3278732

Reputation: 1724

android studio duplicate libraries

What went wrong: 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: /Users/KrikorHerlopian/AndroidStudioProjects/Heinz/app/libs/httpcore-4.3.2.jar File2: /Users/KrikorHerlopian/AndroidStudioProjects/Heinz/app/libs/httpclient-4.3.3.jar File3: /Users/KrikorHerlopian/AndroidStudioProjects/Heinz/app/libs/httpclient-cache-4.3.3.jar File4: /Users/KrikorHerlopian/AndroidStudioProjects/Heinz/app/libs/fluent-hc-4.3.3.jar File5: /Users/KrikorHerlopian/AndroidStudioProjects/Heinz/app/libs/httpmime-4.3.3.jar

I am getting this error when i run my app. i have copies library files to my libs folder. and i have this in my gradle compile fileTree(dir: 'libs', include: ['*.jar'])

Upvotes: 0

Views: 1152

Answers (3)

Suresh Sarak
Suresh Sarak

Reputation: 119

it will help you just add inside android{

}

packagingOptions {
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/DEPENDENCIES'
}

Upvotes: 0

Geralt_Encore
Geralt_Encore

Reputation: 3771

Add to your gradle.build:

packagingOptions {
    exclude 'META-INF/LICENSE'
}

Upvotes: 1

MaxExplode
MaxExplode

Reputation: 2007

Try excluding your duplicating license file in your build.gradle file

packagingOptions { 
exclude 'META-INF/LICENSE.txt'
}

Upvotes: 1

Related Questions