今天在写网络连接的时候发现 API 23 中居然找不到 HttpClient,官方文档似乎是这样说的。
This interface was deprecated in API level 22.
Please use openConnection() instead. Please visit this webpage for further details.
要我用 openConnection() 代替,然而并不会用,以后再研究吧。
那么只有再找办法,还真找到了:
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'
}
问题解决了。

本文介绍了在API23中HttpClient被弃用的问题,并提供了继续使用Apache HTTP API的方法,即通过在build.gradle文件中声明依赖来解决。
1134

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



