HttpClient 4.X repackaged

Disclaimer

  • I know we shouldn't use HttpClient on Android anymore
  • In API 23 we have option to use 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.


    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

    链接地址: http://www.djcxy.com/p/87580.html

    上一篇: 无法在Visual Studio 2015中运行代码分析分析器

    下一篇: HttpClient 4.X重新打包