今天更新了 Android 6.0 的 SDK 后发现项目一片红,吓尿了。
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 theHttpURLConnection 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不再支持 Apache HTTP client。 请使用HttpURLConnection 代替。想要继续使用 Apache HTTP client 的,请添加如上代码。
Android 6.0不再支持Apache HTTP client。若应用使用此客户端且目标API等级为9或更高,则建议使用HttpURLConnection替代,该API通过透明压缩及响应缓存减少网络使用并降低功耗。如需继续使用Apache HTTP API,需在build.gradle中声明依赖。
346

被折叠的 条评论
为什么被折叠?



