Reputation: 193
When i run an Android studio project, i get the following gradle output:
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/NOTICE
File1: C:\Users\Benas\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient-android\4.3.5.1\eecbb0b998e77629862a13d957d552b3be58fc4e\httpclient-android-4.3.5.1.jar
File2: C:\Users\Benas\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3\5b0002c5fb66867ca919be0fbd86de1cfaf76da7\httpmime-4.3.jar
My build.gradle:
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient-4.3.jar"
}
How do i solve the duplicate entry problem?
Upvotes: 2
Views: 903
Reputation: 193
Add this to solve problem:
packagingOptions{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
Upvotes: 2
Reputation: 74046
for the duplicate Meta-Inf stuff all you have to do is add this to your gradle
packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
}
Upvotes: 2