I'm getting this error when performing a gradle build for a release version.
Error: xpp3 defines classes that conflict with classes now provided by
Android. Solutions include finding newer versions or alternative
libraries that don't have the same problem (for example, for
httpclient use HttpUrlConnection or okhttp instead), or repackaging
the library using something like jarjar. [DuplicatePlatformClasses]
I tried to exclude httpclient but that didn't help.
In the debug version its working but in the release version it gives me this error.
I was using Android Asynchronous Http Client but removing it also didn't resolve the error.
My gradle looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.corona.corona"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.pkmmte.view:circularimageview:1.1'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'org.igniterealtime.smack:smack-android:4.1.0'
implementation 'org.igniterealtime.smack:smack-tcp:4.1.0'
implementation 'org.igniterealtime.smack:smack-android-extensions:4.1.0'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.6.0'
implementation 'io.github.rockerhieu:emojicon:1.4.2'
implementation 'io.github.rockerhieu:emojiconize:1.0.0'
implementation 'com.google.android:flexbox:0.3.1'
implementation 'com.mani:ThinDownloadManager:1.4.0'
implementation 'jp.wasabeef:blurry:2.1.1'
implementation 'com.facebook.shimmer:shimmer:0.1.0#aar'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
}
repositories {
mavenCentral()
}
configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
exclude group: 'org.apache.httpcomponents'
}
}
It seems problem comes from Smack library. Try excluding xpp3 module.
configurations {
all {
...
exclude group: 'xpp3', module: 'xpp3'
}
}
You need to exclude xpp3 from the smack library with:
implementation ('org.igniterealtime.smack:smack-android:4.1.0') {
exclude group: 'xpp3', module: 'xpp3'
}
implementation ('org.igniterealtime.smack:smack-tcp:4.1.0') {
exclude group: 'xpp3', module: 'xpp3'
}
implementation ('org.igniterealtime.smack:smack-android-extensions:4.1.0') {
exclude group: 'xpp3', module: 'xpp3'
}
or, like #jose-antelo answer, you can use the following code to remove xpp3 from all of your dependencies:
configurations {
all*.exclude group: 'xpp3', module: 'xpp3'
}
Related
This is my error that i run on a mobile device and this is my Build. Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.medianova.doctorfinder"
minSdkVersion 17
targetSdkVersion 27
multiDexEnabled true
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.facebook.android:facebook-login:4.37.0'
api 'com.facebook.android:facebook-share:4.37.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation files('libs/httpclient-android-4.3.5.1.jar')
implementation 'com.github.yesidlazaro:GmailBackground:1.2.0'
implementation files('libs/httpmime-4.3.5.jar')
//database
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
}
apply plugin: 'com.google.gms.google-services'
I searched a lot but I don't have any solution about this issue.
I use android studio 3.1.0 and Gradle 4.4.
I also this error shown at the bottom of build tab.
MultiDex error is indicated when i run on mobile device.
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
it builds with these versions:
dependencies {
implementation "com.android.support:multidex:1.0.3"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:customtabs:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation ("com.google.firebase:firebase-messaging:17.3.4") {
exclude group: "com.android.support", module:"support-v4"
}
implementation "com.google.firebase:firebase-core:16.0.7"
implementation "com.firebase:firebase-jobdispatcher:0.8.5"
implementation "com.android.volley:volley:1.1.1"
implementation ("com.squareup.picasso:picasso:2.71828") {
exclude group: "com.android.support"
}
implementation ("com.google.android.gms:play-services-ads:17.1.3") {
exclude group: "com.android.support"
}
implementation "com.google.android.gms:play-services-location:16.0.0"
implementation "com.google.android.gms:play-services-analytics:16.0.7"
implementation "com.google.android.gms:play-services-maps:16.1.0"
}
also see Migrating from Firebase JobDispatcher to WorkManager ...
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.mashitha.smartwaterbottle"
minSdkVersion 19
targetSdkVersion 26
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'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
repositories {
maven { url 'https://jitpack.io' }
jcenter()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.github.bumptech.glide:glide:4.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'joda-time:joda-time:2.9.4'
implementation 'com.jjoe64:graphview:4.2.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'me.itangqi.waveloadingview:library:0.3.5'
//Google play services
implementation 'com.google.android.gms:play-services:11.4.0'
implementation 'com.google.firebase:firebase-database:11.4.0'
implementation 'com.google.firebase:firebase-storage:11.4.0'
implementation 'com.google.firebase:firebase-auth:11.4.0'
implementation 'com.google.android.gms:play-services-auth:11.4.0'
implementation 'pub.devrel:easypermissions:0.3.0'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-calendar:v3-rev328-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.airbnb.android:lottie:2.5.5'
compile 'com.android.volley:volley:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
when I add the "implementation 'com.airbnb.android:lottie:2.5.5'", I'm getting this error:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
java.io.IOException: Can't write [C:\Users\Pavan\AndroidStudioProjects\Others Projects\And_Stu_app\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\Pavan.gradle\caches\transforms-1\files-1.1\support-core-ui-27.1.1.aar\bfd8b5be8898d98e8c2045ba6c6ace43\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
What is the reason for that?
You should check the supportLibrary versions. It's probably due to a conflict in the versions. Either you in your code or Lottie's library is using a different supportLibrary version.
Interim fix can be to change the version to be same on both ends, or you could use exclude function of Gradle. for example -
implementation ('com.airbnb.android:lottie:2.5.5'){
exclude group: ‘com.android.support’, module: ‘support-v4’
exclude group: ‘com.android.support’, module: ‘appcompat-v7’
exclude group: ‘com.android.support’, module: ‘recyclerview-v7’
exclude group: ‘com.android.support’, module: ‘design’
}
OR you could declare a Gradle configuration to exclude all support dependencies from 3rd party libraries, by adding this in your build.gradle -
configurations {
all*.exclude module: ‘appcompat-v7’
all*.exclude module: ‘support-v4’
}
I'm having a conflict in libraries and failing to resolve it and the error is always
Multiple dex files define Lorg/apache/http/impl/client/DefaultRequestDirector;
The project compiles and runs if I don't implement the jackson2 and Robospice libraries, however, I need so what to do.
here's my gradle
dependencies {
implementation files('libs/speedchecker-android-sdk-1.3.jar')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.code.gson:gson:2.8.4'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1#aar'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'info.hoang8f:android-segmented:1.0.6'
implementation 'com.google.code.ksoap2-android:ksoap2-android:2.6.0'
testImplementation 'junit:junit:4.12'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
implementation('com.google.http-client:google-http-client-jackson2:1.19.0') {
exclude module: 'commons-io'
exclude module: 'xpp3'
exclude group: 'stax'
}
implementation('com.octo.android.robospice:robospice-google-http-client:1.4.14') {
exclude module: 'commons-io'
exclude group: 'org.apache.commons'
}
}
After trying for several hours, I noticed that the conflict is resulting from the following 3 (the two libraries came with the speed test jar file library when i bought it, so after upgrading the build tools the conflict occurred)
implementation files('libs/speedchecker-android-sdk-1.3.jar')
implementation('com.google.http-client:google-http-client-jackson2:1.19.0') {
exclude module: 'commons-io'
exclude module: 'xpp3'
exclude group: 'stax'
}
implementation('com.octo.android.robospice:robospice-google-http-client:1.4.14') {
exclude module: 'commons-io'
exclude group: 'org.apache.commons'
}
change gradle.property and multidexenable= true;
org.gradle.jvmargs=-Xmx1024m
compile 'com.android.support:multidex:1.0.1'
and also include
multiDexEnabled true
it seems like you're mixing libraries that shouldn't be mixed
looking at your build file these libraries are conflicting:
firebase contains both versions 16.0.1 and 17.1.0 which are conflicting and;
there are dependencies to both firebase and gcm (version 15.0.1 ) which are also conflicting
get rid of those and it should build without issues
I was able to build my gradle without any problem but now suddenly I'm facing this problem.
I've tried to follow similar questions but those were not helpful even I tried to check the firebase version but it's updated. Actually I can't exactly figure out where the error is resided.
After trying to check the gradle option of sidebar I'm getting following error:
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > com.android.build.api.transform.TransformException: Error while generating the main dex list. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at help.gradle.org
Error:
Program type already present: com.google.android.gms.internal.measurement.zzabn
Gradle:
apply plugin: 'com.android.application'
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "community.infinity"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
aaptOptions {
cruncherEnabled = false
}
dexOptions {
preDexLibraries false
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro'
}
debug {
ext.enableCrashlytics = false
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support'
exclude module: 'support-annotations'
exclude module: 'support-v4'
exclude module: 'support-v13'
exclude module: 'recyclerview-v7'
exclude group: 'com.android.support', module: 'appcompat-v7'
})
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta5'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.adamstyrc.cookiecutter:cookie-cutter:1.0.2'
implementation 'com.allattentionhere:fabulousfilter:0.0.5'
implementation 'com.github.florent37:diagonallayout:1.0.6'
implementation 'com.flaviofaria:kenburnsview:1.0.7'
implementation 'com.vstechlab.easyfonts:easyfonts:1.0.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.github.pwittchen:swipe:0.1.0'
implementation 'com.thesurix.gesturerecycler:gesture-recycler:1.4.0'
implementation 'com.github.iammert:MaterialIntroView:1.6.0'
implementation 'com.github.oxoooo:touch-image-view:1.0.1'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'
implementation('io.socket:socket.io-client:0.8.3') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
implementation 'com.google.gms:google-services:3.2.0'
implementation 'com.iceteck.silicompressorr:silicompressor:2.1'
implementation 'com.fenchtose.nocropper:nocropper:0.2.0'
implementation 'me.relex:circleindicator:1.2.2#aar'
implementation('com.google.guava:guava:23.4-android') {
exclude group: 'com.android.support'
exclude module: 'support-annotations'
exclude module: 'support-v4'
exclude module: 'support-v13'
exclude module: 'recyclerview-v7'
exclude group: 'com.android.support', module: 'appcompat-v7'
}
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation 'com.orhanobut:hawk:2.0.1'
implementation 'com.zsoltsafrany:needle:1.0.0'
implementation 'com.github.madrapps:pikolo:1.1.6'
implementation 'jp.wasabeef:richeditor-android:1.2.2'
implementation 'com.android.support:palette-v7:27.1.0'
testImplementation 'junit:junit:4.12'
implementation('com.github.bumptech.glide:glide:4.4.0') {
transitive = true
}
implementation ("com.github.bumptech.glide:recyclerview-integration:4.4.0") {
// Excludes the support library because it's already included by Glide.
transitive = false
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation 'com.android.support:multidex:1.0.3'
implementation "me.leolin:ShortcutBadger:1.1.21#aar"
implementation 'com.hbb20:ccp:2.1.2'
}
apply plugin: 'com.google.gms.google-services'
Try commenting implementation 'com.google.gms:google-services:3.2.0' this line and try again. It should work.
EDIT:
Try upgrading google-services plugin version to 3.3.0 as said in android-developers blog. And verify your versions against release notes
After updating my android studio and build tool version get this error.I have tried all the solution available for this problem over internet , but not successful
don't know why this is happening ??
Android studio version: 3.1
Gradle version": 4.4
Gradle plugin : 3.1
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
My build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.abc.abc"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true //Tryed this but not worked
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven {
url 'https://github.com/jitsi/jitsi-maven-repository/raw/master/releases'
}
// maven { url "https://dl.bintray.com/michelelacorte/maven/" }
mavenCentral()
}
configurations {
all*.exclude module: 'support-v4'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:support-fragment:27.1.0'
// multipart entity
implementation('org.apache.httpcomponents:httpmime:4.+') {
exclude module: "httpclient"
}
implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
// implementation 'com.wonderkiln:camerakit:0.13.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'org.jitsi.react:jitsi-meet-sdk:1.9.0'
// compile 'com.google.code.gson:gson:2.2.4'
// compile 'com.android.support:support-emoji:26.0.1'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.yalantis:ucrop:2.2.0-native'
implementation 'com.pnikosis:materialish-progress:1.7'
implementation 'org.igniterealtime.smack:smack-android-extensions:4.2.0'
implementation 'org.igniterealtime.smack:smack-experimental:4.2.0'
implementation 'org.igniterealtime.smack:smack-tcp:4.2.0'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
implementation 'com.googlecode.libphonenumber:libphonenumber:7.0.4'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.google.android.gms:play-services-places:11.8.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.eyalbira.loadingdots:loading-dots:1.0.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
// implementation 'com.google.android.exoplayer:exoplayer:2.7.1'
// compile 'it.michelelacorte.swipeablecard:library:2.3.0#aar'{
// exclude module: 'appcompat-v7'
// exclude group: 'com.android.support'
// }
// BUTTER KNIFE
implementation('com.jakewharton:butterknife:8.5.1') {
exclude module: 'appcompat-v7'
exclude group: 'com.android.support'
}
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
// implementation project(':libemoji')
implementation 'com.android.support:support-v13:27.1.0'
}
It's waste almost my 10 days...
most confusing error ever encounter..
This error happens if your code has two different modules of google-play-services or support-v4 which are using different versions of these libraries.
Check the dependencies of the libraries you are using in your project or use
gradle app:dependencies
to see dependency tree of your project and then when you find out which libraries is used with different version, add it to your dependencies with correct version. For example if google-play-services:location:11.2.0 appeared in your dependencies, replace it with google-play-services:location:11.8.0
Usually you will see a warning or error message in your build.gradle file (i.e. one dependency will be marked with red underline showing it cause version mismatch) in such cases.
In my case, project and module's package name is same. When running in debug mode, everything is okey. But when i want to build release mode. I got this error. Renaming package name is the solution for me.