I'm getting the following error. I have not tried to solve it the last two days, but nothing had solved the problem.
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: org/apache/http/HttpMessage.class
here is my build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.0'
defaultConfig {
applicationId "com.mycompany.newlogin"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.guava:guava-jdk5:17.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
}
please help me with this .thank you in advance.
I too had this Error and i resolved this by removing httpcore
in your build.gradle(app) Remove these lines
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
and then add latest apache library to your build.gradle(app)
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
Have a look at your referenced packages, org.jbundle.util.osgi.wrapped.org.apache.http.client seems to contain at least some classes of httpcore, especially that one mentioned in your error message. So I guess you simply can't and shouldn't use both as dependencies, but only the ones you really need.
The following libraries were causing conflict and i removed it from build.gradle
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
and i left only with :
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
Related
I have problem on AppLovin.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/applovin/adview/AdViewController.class
My gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "in.earnpaytm.dhankubair"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.google.android.gms:play-services-ads:9.6.1'
compile 'com.google.android.gms:play-services-fitness:9.6.1'
compile 'com.google.android.gms:play-services-wearable:9.6.1'
compile 'com.applovin:applovin-sdk:7.3.2'
compile 'com.github.paolorotolo:appintro:4.1.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
}
dependencies {
compile 'com.google.android.gms:play-services-ads:9.6.1'
}
dependencies {
compile 'com.google.android.gms:play-services-auth:9.6.1'
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
My Manifest
<meta-data android:name="applovin.sdk.key" android:value="3Uwn4udUbwnsMOvbmpDJ7IEegaoOPqmSIgDNZrtd061wiokw5rCKUuwGGJ50nNg_mFqdPaFPgHKO32J9uVTM" />
<activity android:name="com.applovin.adview.AppLovinInterstitialActivity" android:configChanges="orientation|screenSize"/>
<activity android:name="com.applovin.adview.AppLovinConfirmationActivity" android:configChanges="orientation|screenSize"/>
And I have two applovin sdk
1.applovin-sdk-7.3.2
2.applovin-sdk-7.3.2-javadoc
Help me to resolves this problem!
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/applovin/adview/AdViewController.class
It means that you are adding twice the same classes.
According with your comment:
Do you have also a jar for applovin?
#GabrieleMariotti Yes!
Since you are using:
compile 'com.applovin:applovin-sdk:7.3.2'
Delete the .jars related to applovin library from your libs folder
it looks like you're adding the AppLovin library multiple times. either remove this line from your gradle.build file:
compile 'com.applovin:applovin-sdk:7.3.2'
or delete these .jars from your libs folder:
applovin-sdk-7.3.2.jar
applovin-sdk-7.3.2-javadoc.jar
you only need one or the other, but not both.
i'm having a probleme when creating the APK
When i run the app, it works fine but when i build the apk it says
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/location/places/PlaceReport.class
gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
useLibrary 'org.apache.http.legacy'
configurations {
}
defaultConfig {
applicationId "inc.exemple"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.1.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.1gravity:android-rteditor:1.6.2'
compile 'com.github.irshulx:laser-native-editor:0.3.5'
compile 'com.github.arturogutierrez:badges:1.0.5#aar'
compile 'com.mikepenz:actionitembadge:3.3.1#aar'
compile 'com.mikepenz:iconics-core:2.8.1#aar'
compile 'com.mikepenz:fontawesome-typeface:4.7.0.0#aar'
compile 'com.synnapps:carouselview:0.0.10'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
I believe i should exlude it, but i don't know how, please help, thank you.
So i had to create a new empty project and copy all the libs in it, and try one by one to find which one was containing the problem. the error was coming from the com.github.irshulx:laser-native-editor:0.3.5, it worked after i deleted it, then i modified the whole project and used another work around.
I got this error when I run the code ->
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzafz.class
I have no idea what does it means and do I fix it. I need your help guys
I have treid several things but nothing really helped, I added "multiDexEnabled true" and that cause to that error.
Before that error O had "android error finished with non-zero exit value 2". After I added "multiDexEnabled true", it gives me this error:
"duplicate entry: com/google/android/gms/internal/zzafz.class Error"
How can I fix it, any help would be appreciated!
this is my Manifest
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.world.bolandian.gpstracker"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.google.firebase:firebase-database:9.2.1'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
}
apply plugin: 'com.google.gms.google-services'
remove compile 'com.google.android.gms:play-services-maps:9.6.1' and clean-build the project
You are including both the legacy Firebase API:
compile 'com.firebase:firebase-client-android:2.3.1'
and the new Firebase APIs:
compile 'com.google.firebase:firebase-database:9.2.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
They should not be used together. Remove firebase-client-android:2.3.1 and follow the instructions in the Firebase Upgrade guide.
It is also important to use the same versions of Firebase and Play Services libraries. Don't use 9.6.1 of play-services-maps and 9.2.1 of the Firebase libs. The latest versions available are 10.0.1. Consider updating all of your dependencies to use the latest versions.
Update:
I copied the dependencies you posted and was able to reproduce the error. After I replaced the dependencies with these, the error was resolved. Do these not work for you?
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
}
I know this is a repeated question but I tried numerous code but couldn't solve the error
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.class
gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.cwish"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:recyclerview-v7:23.1.0#aar'
compile 'com.daimajia.numberprogressbar:library:1.2#aar'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.koushikdutta.ion:ion:2.+'
}
I guess this problem can be resolved by removing duplicate dependencies,before removing the duplicate dependencies, you should check your modules by this command:
gradlew -q dependencies yourProject:dependencies --configuration compile
refer to this answer:duplicate dependencies problem
Hope it can help you :)
Looks like duplicate dependency problem, remove "compile 'com.android.support:recyclerview-v7:23.1.0#aar" and it'll be fine.
when i import project eclipse to android studio. It make error about compile. I want to try fix follow: How to add Apache HTTP API (legacy) as compile-time dependency to build.grade for Android M? But it's not working. please help me!
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/annotation/GuardedBy.class
file build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "vae.vnsupermark.com"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled = true
// versionCode 1
// versionName "1.0"
ndk {
moduleName "vnsm"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
// compile 'com.android.support:appcompat-v7:20.0.0'
// compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:4.0.30'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/error-reporter.jar')
//compile files('libs/httpclient-4.0.1.jar')
compile files('libs/mail.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
}
You should remove
compile fileTree(dir: 'libs', include: ['*.jar'])
because it will still compile the library (and all other jars in libs folder), as apparently it is not deleted from libs folder.
After this change, commenting out
//compile files('libs/httpclient-4.0.1.jar')
will really work as you expect :)