android api23 抛弃了httpClient,许多基于httpClient第三方库怎么办?

android sdk升级了api23,原生sdk不提供org.apache.http.*的类(仅仅保留几个)。java上最常用的httpClient也没有了。

一直使用android-async-http、android-ImageLoader等第三方库,都要引用httpClient,这样的话,是要去apache官网下载httpClient.jar来用吗?

阅读 18.5k
3 个回答

To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:

android {

useLibrary 'org.apache.http.legacy'

}

新手上路,请多包涵
// Apache Http
android {
    useLibrary 'org.apache.http.legacy'
}
// Header
dependencies {
    compile "org.apache.httpcomponents:httpcore:4.3.2"
}
新手上路,请多包涵

libs中导入org.apache.http.legacy.jar
该jar包在:**\sdk\platforms\android-23\optional下

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题