Android studio中“import org.apache.http.Header; 不可用
2015-10-27 13:36
465 查看
出处:http://www.zhihu.com/question/35597452/answer/63619567
梁利晖、渡扬子 赞同
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:
Android studio中“import org.apache.http.Header;”没用?
ShinChven,使用:Xperia/Android/OSX/iOS/Ubuntu/Ce…
梁利晖、渡扬子 赞同Android M 起默认移除了Apache HTTP:https://developer.android.com/intl/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' }
相关文章推荐
- 部署基于apache2.4.9的https实验
- OkHttp使用笔记
- android 6.0 使用HttpClient
- 大神给你分析HTTPS和HTTP的区别
- 获取HttpResponse并解析JSON数据
- Android网络请求库对比之HttpUrlConnection和HttpClient
- javax.servlet.http.HttpServletRequest cannot be resolved
- 转载!!:网络协议学习导图
- XCode 7.1 发送HTTP请求报错解决办法
- asp_net_webapi_httpclient.html
- [转] 虚拟机VMware3种网络模式(桥接、nat、Host-only)的工作原理
- App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Te
- Linux系统上安装MRTG来监控网络流量
- TCP同步与异步及阻塞模式,多线程+阻塞模式,非阻塞模式简单介绍
- tcp连接状态以及netstat命令
- Android开源网络电话Sipdroid
- 老李分享:curl发起https请求
- Http与协议TCP协议简单易懂
- .NET MVC4 用HttpClient后台post 请求webapi
- 新bolg地址 http://www.milletblog.com/