android - 依赖 org.apache.httpcomponents :httpclient:4. 4.1 被忽略发布因为它可能与 Android 提供的内部版本冲突

标签 android android-studio

我在我的项目中使用了 httpmime 和 httpcore,但我收到了这个警告

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.

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 文件中

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'}

知道如何解决这个问题吗?

最佳答案

先去掉线条 编译'org.apache.httpcomponents:httpcore:4.4.1' 编译 'org.apache.httpcomponents:httpmime:4.4.1'

然后在他们的位置添加行 in build.gradle given by:

compile ('org.apache.httpcomponents:httpmime:4.3'){
    exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'commons-io:commons-io:1.3.2'

如果您的 compileSdkVersion 是 19(在我的情况下),您可以试试这个。希望这能解决问题...

关于android - 依赖 org.apache.httpcomponents :httpclient:4. 4.1 被忽略发布因为它可能与 Android 提供的内部版本冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30755989/

相关文章:

android - 将对象属性分配给 ListView

java - 在Java文件中添加ID

java - 为 TextView 创建简单的文本弹出窗口

android - android 中的正则表达式只接受英语

android - 在 Android 中创建 sqlite 表时出错

android-studio - Android Studio 3.0 运行速度非常非常慢

android - 无法解析 : com. google.code.gson :gson. 2.2.2

json - Http GET 方法到 Https?

java - 如何为带有搜索的 ListView 设置 onClickListener?不带立场

android-studio - 找不到参数的方法 ksp()