Android 6.0 使用HttpClient的问题
16lz
2021-01-23
Apache HTTP Client Removal
Android 6.0 release removes support for the Apache HTTP client. 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:
android { useLibrary 'org.apache.http.legacy' }
也就是说Android 6.0移除了httpClient的SDK,推荐使用HttpURLConnection。如果你还想用httpClient,在build.gradle添加上面上面的代码就好了。
此library在本地的sdk中:sdk\platforms\android-23\optional
更多相关文章
- 第一行代码:AlertDialog
- Android 自动更新代码
- Android 自制一个工作日历 原代码
- android 网络视频代码
- android版本更新代码
- 系出名门 Android源代码
- Android应用程序安装过程源代码分析(3)
- Android开发——控件基础(七)ListView组件:示例代码
- Ubuntu 13.04 编译环境配置及android 2.3 源代码编译时出现了以