Reputation: 842
Please help me, I am new in android studio, I am trying to send image file to server using MultiPartRequester
, in Eclipse it is working fine but in Android Studio I added dependency
compile org.apache.httpcomponents:httpcore:4.2.4
compile org.apache.httpcomponents:httpmime:4.3
and I am getting this error
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: C:\Users\active 36\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.3\11393498b38e9695d0850cac26fde5613ae268b9\httpcore-4.3.jar
File2: C:\Users\active 36\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3\5b0002c5fb66867ca919be0fbd86de1cfaf76da7\httpmime-4.3.jar
Gradle:
compile 'com.android.support:multidex:1.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile 'log4j:log4j:1.2.17'
// compile 'de.mindpipe.android:android-logging-log4j:1.0.3'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: "$buildDir", include: 'native-libs.jar')
compile project(':wordPayLib')
compile project(':simple-crop-image-lib')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.+'
compile 'com.crittercism:crittercism-android-agent:+'
compile 'com.google.android.gms:play-services:10.0.+'
compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.firebase:firebase-messaging:10.0.0'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.googlecode.android-query:android-query:0.24.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile "org.apache.httpcomponents:httpcore:4.2.4"
compile "org.apache.httpcomponents:httpmime:4.3"
Please any one help me to solve this.Thank you.
Upvotes: 2
Views: 1056
Reputation: 75798
Try with
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
Then Clean-Rebuild And Run
You are getting
DuplicateFileException: Duplicate files copied in APK
Make sure Same dependencies are calling or not .
Comment
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile "org.apache.httpcomponents:httpcore:4.2.4"
compile "org.apache.httpcomponents:httpmime:4.3"
DO
compile group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
Upvotes: 4
Reputation: 2767
In your gradle file add packagingOptions
in android block.
android {
packagingOptions {
exclude 'META-INF/LICENSE'
}
}
Upvotes: 0