问题描述
我在我的项目中使用 httpmime 和 httpcore,但收到此警告
I am using httpmime and httpcore in my project and I am getting this warning
警告:依赖 org.apache.httpcomponents:httpclient:4.4.1 是忽略调试,因为它可能与内部版本冲突由安卓提供.
警告:依赖 org.apache.httpcomponents:httpclient:4.4.1 是忽略调试,因为它可能与内部版本冲突由安卓提供.
Warning:Dependency org.apache.httpcomponents:httpclient:4.4.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
我的依赖看起来像这样
dependencies {
compile files('libs/gson-2.2.2.jar')
compile files('libs/classes.jar')
compile files('libs/gcm.jar')
compile files('libs/splunk-mint-4.2.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpmime:4.4.1'}
按照其他地方的建议,我将此添加到我的 build.gradle 文件中
As suggested in other places I added this to my build.gradle file
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'}
知道如何解决这个问题吗?
Any idea how to solve this issue?
推荐答案
使用重新打包的apache http客户端适用于android
Use repacked version of the apache http client suitable for android
dependencies {
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}
https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html
这篇关于依赖 org.apache.httpcomponents:httpclient:4.4.1 在发布时被忽略,因为它可能与 Android 提供的内部版本冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!