The Apache HTTP client has been deprecated for quite some time—since 2011 or so. Using this client on Android 2.3 and higher was not recommended; now with Android 6.0 Marshmallow, this API has been removed. So, we'll use the HttpURLConnection
class instead.
This API is more efficient, reduces network use, and minimizes power consumption.
If you wish to continue using the Apache HTTP APIs, you must first declare the following compile-time dependencies in your build.gradle
file:
android { useLibrary 'org.apache.http.legacy' }