Android(安卓)studio中“import org.apache.http.Header; 不可用
16lz
2021-12-04
出处:http://www.zhihu.com/question/35597452/answer/63619567
要使用的话,要这么干
1、在gradle-wrapper.properties中配置使用较新版本的gradle
Android studio中“import org.apache.http.Header;”没用?
ShinChven,使用:Xperia/Android/OSX/iOS/Ubuntu/Ce…
梁利晖、渡扬子 赞同 Android M 起默认移除了Apache HTTP: https:// developer.android.com/i ntl/zh-cn/preview/behavior-changes.html要使用的话,要这么干
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'}
更多相关文章
- 箭头函数的基础使用
- NPM 和webpack 的基础使用
- Python list sort方法的具体使用
- 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
- Android(安卓)Lock 使用
- Android下使用Logcat打印信息
- Android(安卓)UI: LinearLayout中layout_weight 属性的使用规则
- Android(安卓)系统应用调用,intent 的使用方法总结
- Android各种获取Context方法