提问者:小点点

警告:依赖关系org.apache.httpcomponents: httpClient: 4.0.1被忽略


我得到以下错误:

    Information:Gradle tasks [:app:assembleDebug]
    Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
             In case of problem, please repackage it with jarjar to change the class packages
    Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
             In case of problem, please repackage it with jarjar to change the class packages
    :app:preBuild UP-TO-DATE
   .....
    :app:compileDebugNdk UP-TO-DATE
    :app:compileDebugSources
    :app:transformClassesWithDexForDebug
    UNEXPECTED TOP-LEVEL EXCEPTION:
    Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
    > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2

我知道libs2中的文件会导致错误,因为我会根据此人的建议逐个添加它们,看看哪些会导致问题。

我正在遵循一个教程,该教程需要所有这些.jar文件,所以我不明白为什么我会收到这些错误,因为它们是必要的。


共2个答案

匿名用户

使用Gradle无需降级或查找另一个jar-因为可以按组/模块过滤:

compile ('com.google.http-client:google-http-client-jackson2:1.21.0') {
    exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}

匿名用户

在5.0及更高版本(api23)中,http客户端被取消了保护,甚至不存在降级maxsdk或使用url连接的情况下,您应该找到与api23兼容的最新jar文件