Android API 23 - HttpClient 4.X 重新打包 [英] Android API 23 - HttpClient 4.X repackaged

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

问题描述

免责声明

  • 我知道我们不应该再在 Android 上使用 HttpClient
  • 在 API 23 中,我们可以选择使用 useLibrary 'org.apache.http.legacy'

我想继续使用 HttpClient(我也维护基于它的库和项目)但是,API 23 中的类已经消失了.

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 解决方法并没有消失,但不能用于进一步开发(类不会自动完成,所有内容都显示为无效代码)

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

我们还可以选择使用 HttpClient 4.3.5.1 的 HttpComponents 提供的 Android 分支,但是它不提供 Android 在 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 的 target/compile-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 ?

我能找到的最新完整重新打包是 https://code.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

我还对 HC 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.

推荐答案

好吧,为了回答我自己的问题,我提出了一个项目,该项目将与 HttpMime、HttpCore 和 HttpClient-Cache 包一起重新打包和构建 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 Central 上以标识符 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 重新打包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆