Disclaimer
useLibrary 'org.apache.http.legacy'
I'd like to continue using HttpClient (also I maintain libraries and projects based on it) however, with API 23 the classes are gone.
Well not gone with useLibrary
workaround, but cannot be used to develop any further (classes don't autocomplete, everything is shown as invalid code)
We also have option to use HttpComponents provided Android fork of HttpClient 4.3.5.1, which however doesn't provide classes/headers/interfaces that Android provided on API < 22, so it compiles, but we're still unable to developer effectively.
Is there any full HttpClient library repackage (favorably even versions higher than 4.3) which can be used further with target/compile-Sdk of version 23 ?
Latest full repackage I could find is https://code.google.com/p/httpclientandroidlib/ which uses version 4.3.2
I've also added comment to HC JIRA issue https://issues.apache.org/jira/browse/HTTPCLIENT-1632
This workaround will be probably needed only until HttpClient 5.X will be released, as it should have completely different package names.
With the Android M SDK (API 23), Google removed the Apache HTTP Client library. It was deprecated since API 22, and Google recommanded to use HttpURLConnection instead since API 9.
With the Android M SDK (API 23), Google removed the Apache HTTP Client library. It was deprecated since API 22, and Google recommanded to use HttpURLConnection instead since API 9. While the classes are still bundled in Android 6 ROMs, it won’t be long until we see them completely go away.
Initial release. The system version is 4.3. Android SDK Platform-tools r18 or higher is required. Android SDK Tools 22.0.4 or higher is recommended. For details about the platform changes, see the Jelly Bean overview and Android 4.2 API changes.
Android 7.0 (API level 24) For details about the platform changes, see Android 7.0 for developers. Revision 1 (August 2016) Android 6.0 (API level 23)
Well, to answer my own question, I've put up project, which will repackage and build HttpClient in bundle with HttpMime, HttpCore and HttpClient-Cache packages into different namespace.
Currently the version provided is 4.3.3 (in sync with ASF HC 4.3.3 version)
https://github.com/smarek/httpclient-android
It's quite customizable, so changing the package/artifact name or version, adjusting the build to your needs and so on should be no problem.
It's also published on Maven Central under identifier cz.msebera.android:httpclient:4.3.3
and all your code imports currently using org.apache.http
should be migrated (for sake of using this library) to cz.msebera.android.httpclient
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With