首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >分级Xpp3误差

分级Xpp3误差
EN

Stack Overflow用户
提问于 2018-01-28 16:28:05
回答 2查看 2.5K关注 0票数 10

在为发行版执行gradle构建时,我会得到这个错误。

错误: xpp3定义了与现在由Android提供的类冲突的类。解决方案包括找到不存在相同问题的更新版本或替代库(例如,对于httpclient使用HttpUrlConnection或okhttp ),或者使用jarjar之类的方法重新打包库。DuplicatePlatformClasses

我试图将httpclient排除在外,但这并没有帮助。

在调试版本中,它是工作的,但是在发布版本中,它给出了这个错误。

我使用的是Android异步Http客户端,但是删除它也不能解决错误。

我的秤看起来是这样的:

代码语言:javascript
复制
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'
    }
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-02-12 12:15:29

问题似乎来自Smack库。尝试排除xpp3模块。

代码语言:javascript
复制
configurations {
    all {
        ...
        exclude group: 'xpp3', module: 'xpp3'
    }
}
票数 21
EN

Stack Overflow用户

发布于 2018-02-12 13:29:48

您需要将xpp3从smack库中排除出来:

代码语言:javascript
复制
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'
}

或者,像@jose-antelo答案一样,可以使用以下代码从所有依赖项中删除xpp3:

代码语言:javascript
复制
configurations {
  all*.exclude group: 'xpp3', module: 'xpp3'
}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48488563

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档