Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Xpp3 error

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'
    }
}
like image 545
shrey ambesh Avatar asked Jan 28 '18 16:01

shrey ambesh


1 Answers

It seems problem comes from Smack library. Try excluding xpp3 module.

configurations {
    all {
        ...
        exclude group: 'xpp3', module: 'xpp3'
    }
}
like image 88
Jose Antelo Avatar answered Sep 23 '22 16:09

Jose Antelo