gpt4 book ai didi

java - Android studio 中的重复类冲突

转载 作者:行者123 更新时间:2023-12-02 03:02:25 27 4
gpt4 key购买 nike

迁移到 androidx 时,我发现模块 httpmime-4.0.1.jarhttpmime-4.3.6.jar 存在一些冲突。

我在gradle中尝试了一些代码:

apply plugin: 'com.android.application'

android {
compileSdkVersion 29
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.links.meplinks"
minSdkVersion 19
targetSdkVersion 29
versionCode 29
versionName "1.15.11"
multiDexEnabled true

android.compileOptions.sourceCompatibility 1.8
android.compileOptions.targetCompatibility 1.8
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://dl.bintray.com/hani-momanii/maven" }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'



compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
exclude module:'httpmime-4.0.1'
}


}

Duplicate class org.apache.http.entity.mime.FormBodyPart found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.HttpMultipart found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.HttpMultipart$1 found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.HttpMultipartMode found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.MIME found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.MinimalField found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.MultipartEntity found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.content.AbstractContentBody found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.content.ContentBody found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.content.FileBody found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.content.InputStreamBody found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6) Duplicate class org.apache.http.entity.mime.content.StringBody found in modules httpmime-4.0.1.jar (httpmime-4.0.1.jar) and httpmime-4.3.6.jar (org.apache.httpcomponents:httpmime:4.3.6)

Go to the documentation to learn how to Fix dependency resolution errors.

最佳答案

尝试将 httpmime 更新到 4.5.6 并排除 httpcore-4.4.10 模块

implementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
implementation ('org.apache.httpcomponents:httpmime:4.5.6'){
exclude module: 'httpclient'
exclude module:'httpcore-4.4.10'
}

关于java - Android studio 中的重复类冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57041477/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com