Android 6.0 SDK无法使用HttpClient的解决办法


  

前言

转自Google官博
*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. *

Google为了强推HttpURLConnection,直接在Android 6.0 SDK中移除了Apache HttpClient库支持,不过并没有把这条路堵死,并给出了解决办法,看来Google也不敢乱来啊_

解决办法

eclipse ADT

libs中加入.\sdk\platforms\android-23\optional\org.apache.http.legacy.jar

Android Studio

在对应的Module下的build.gradle中加入:

android {
    useLibrary 'org.apache.http.legacy'
}

虽然Google给出了解决办法,但还是推荐大家使用轻量级的HttpURLConnection,毕竟官方支持。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值