Android6.0找不到org.apache.http.Header的问题
2015-12-03 10:39
656 查看
在使用Android Studio时,采用了最新的编译版本android 6.0,但是发现在运行时,之前程序里引用的org.apache.http.Header类找不到了。通过查找发现:
Android 6.0 release removes support for the Apache HTTP client.
也就是说Http Client在android 6.0 被移除了,那怎么使用呢?
If your app is using this client and targets Android 2.3 (API level 9) or higher, use the HttpURLConnection class instead. This API is more efficient because it reduces network use through transparent compression and response caching, and minimizes power consumption. To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:
就是在build.gradle进行配置一下:
以下是我的build.gradle的配置:
Android 6.0 release removes support for the Apache HTTP client.
也就是说Http Client在android 6.0 被移除了,那怎么使用呢?
解决方法:
官方文档里提供了这么一段话:If your app is using this client and targets Android 2.3 (API level 9) or higher, use the HttpURLConnection class instead. This API is more efficient because it reduces network use through transparent compression and response caching, and minimizes power consumption. To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:
就是在build.gradle进行配置一下:
android { useLibrary 'org.apache.http.legacy' }
以下是我的build.gradle的配置:
android { useLibrary 'org.apache.http.legacy' compileSdkVersion 23 buildToolsVersion '23.0.2' ...
相关文章推荐
- TCP/IP模型各个层次的功能和协议
- 【python】网络编程-UDP协议套接字
- IOS开发中如何检测网络连接
- 10021---Java+MySQL实现网络爬虫程序
- JAVA 进行https传输中文乱码解决
- [网络管理]全双工与半双工的区别
- 32、OSPF在帧中继中不同网络类型配置总结
- xCODE7.1进行网络访问的设置
- iOS开发-网络篇 文件的上传
- Android Volley完全解析(二),使用Volley加载网络图片
- 程序中使用ajax时,type为put,或者delete时在 IIS上没效果,发生HTTP Error 405.0 - Method Not Allowed
- "javax.servlet.http.HttpServlet"was not found on the java build path
- TCP,IP详解,卷一:协议学习笔记之第一章概述
- 介绍一篇关于session的好文章
- 【网络爬虫】数据采集——将html的数据分析保存到数据库
- window环境下的apache的https的配置
- 【网络爬虫】数据的采集——爬取土木在线网的数据
- iOS 网络与多线程--2.同步Get方式的网络请求(阻塞)
- Socket TCP粘包拆包
- BP神经网络拟合数据及调优