为什么我不能在 AS 中使用 HttpClient
Why I can't use HttpClient in AS
为什么我不能在 Android Studio 中使用 HttpClient
?我的 ADT:23,我的 SDK:24。用HttpClient
代替HttpURLConnection
不好吗?
Android 6.0 release removed 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:
useLibrary 'org.apache.http.legacy'
有关详细信息,请参阅 here。
为什么我不能在 Android Studio 中使用 HttpClient
?我的 ADT:23,我的 SDK:24。用HttpClient
代替HttpURLConnection
不好吗?
Android 6.0 release removed 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 yourbuild.gradle
file:
useLibrary 'org.apache.http.legacy'
有关详细信息,请参阅 here。