http://www.zhihu.com/question/35597452/answer/63619567
使用的是Android-async-http
Android M 起默认移除了Apache HTTP:
https://developer.android.com/intl/zh-cn/preview/behavior-changes.html
要使用的话,要这么干
1、在gradle-wrapper.properties中配置使用较新版本的gradle
2、在build.gradle中使用较新版本的gradle buildtools
3、添加以下依赖,重新使用已经deprecated 的apache http 包:
4、添加apache http component 的依赖,补全缺失的类,比如Header:
要使用的话,要这么干
1、在gradle-wrapper.properties中配置使用较新版本的gradle
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile 'org.apache.httpcomponents:httpcore:4.4.2'
}