出处:http://www.zhihu.com/question/35597452/answer/63619567

Android studio中“import org.apache.http.Header;”没用?

ShinChven,使用:Xperia/Android/OSX/iOS/Ubuntu/Ce…

梁利晖、渡扬子 赞同 Android M 起默认移除了Apache HTTP: developer.android.com/i
要使用的话,要这么干
1、在gradle-wrapper.properties中配置使用较新版本的gradle
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
2、在build.gradle中使用较新版本的gradle buildtools
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    }}
3、添加以下依赖,重新使用已经deprecated 的apache http 包:
android {    useLibrary 'org.apache.http.legacy'}
4、添加apache http component 的依赖,补全缺失的类,比如Header:
dependencies {    compile 'org.apache.httpcomponents:httpcore:4.4.2'}

更多相关文章

  1. 箭头函数的基础使用
  2. NPM 和webpack 的基础使用
  3. Python list sort方法的具体使用
  4. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
  5. Android(安卓)Lock 使用
  6. Android下使用Logcat打印信息
  7. Android(安卓)UI: LinearLayout中layout_weight 属性的使用规则
  8. Android(安卓)系统应用调用,intent 的使用方法总结
  9. Android各种获取Context方法

随机推荐

  1. Android(安卓)属性动画 实现view翻转 旋
  2. 密码输入框
  3. Android(安卓)Recovery的汉化 显示中文
  4. BroadcastReceive介绍
  5. Android(安卓)和 前端的类似点(持续更新)
  6. Bitmap,byte流,drawable之相互转换
  7. Android(安卓)Lint
  8. Android(安卓)中传递 json 的问题
  9. Android(安卓)MediaScannerConnection,And
  10. Android(安卓)– 切换夜间模式