本文介绍了Android的API 23 - HttpClient的4.X重新包装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

免责声明

  • 我知道我们不应该在Android上使用的HttpClient了
  • 在API 23我们选择使用 useLibraryorg.apache.http.legacy

我想继续使用但HttpClient的(也是我坚持基于它库和项目​​),与23 API的类都没有了。

I'd like to continue using HttpClient (also I maintain libraries and projects based on it) however, with API 23 the classes are gone.

好了没有去与 useLibrary 的解决方法,但不能用于开发任何进一步的(类不自动完成,一切都显示为无效,code)

Well not gone with useLibrary workaround, but cannot be used to develop any further (classes don't autocomplete, everything is shown as invalid code)

我们还可以选择使用HttpComponents提供了Android的叉的HttpClient 4.3.5.1 ,但它不提供的Andr​​oid提供的API与其中的类/头/接口; 22,所以它编译,但是我们仍然不能有效地开发。

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.

有没有充分HttpClient库重新包装(毫不逊色,甚至高于4.3的版本),它可以进一步使用版本23,目标/编译SDK?

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 ?

最新的全分装,我能找到的<一个href="https://$c$c.google.com/p/httpclientandroidlib/">https://$c$c.google.com/p/httpclientandroidlib/它采用4.3.2版

Latest full repackage I could find is https://code.google.com/p/httpclientandroidlib/ which uses version 4.3.2

我还添加注释慧聪JIRA问题https://issues.apache.org/jira/browse/HTTPCLIENT-1632

I've also added comment to HC JIRA issue https://issues.apache.org/jira/browse/HTTPCLIENT-1632

此变通办法将可能只需要到HttpClient的5.X将被释放,因为它应该有完全不同的包名。

This workaround will be probably needed only until HttpClient 5.X will be released, as it should have completely different package names.

推荐答案

好了,回答我的问题,我已经忍了项目,该项目将重新包装,并捆绑建设的HttpClient与HttpMime,的HttpCore和HttpClient的-缓存封装成不同的命名空间。

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.

目前提供的版本是 4.3.3 (与ASF HC 4.3.3版本同步)

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.

它也发表了关于Maven的中央下标识符 cz.msebera.android:httpclient:4.3.3 和目前正在使用 org.apache.http 应迁移(对于为了使用这个库),以 cz.msebera.android.httpclient

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

这篇关于Android的API 23 - HttpClient的4.X重新包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 19:26