Android API 23中废弃了HttpClient的解决办法

今天在写网络连接的时候发现 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'
}

问题解决了。

你可能感兴趣的:(Android,小技巧)