摇篮重命名行家依赖包(HttpComponents,Android版) [英] Gradle rename maven dependency package (HttpComponents, Android)

查看:219
本文介绍了摇篮重命名行家依赖包(HttpComponents,Android版)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用和选择的方式,使Android上的HTTP(S)请求是一个长期的痛苦。

尽管谷歌希望我们使用HttpURLConnection类,还有那些谁preFER使用的HttpClient来代替。

有是这个库,的https://$c$c.google.com/ p / httpclientandroidlib / 带包装的脚本。

我宁愿用更多的东西整合与Android构建环境。

有可能以同样的方式httpclientandroidlib使用摇篮重新包装Maven的依赖关系(整个树,包括HttpClient的,httpcomponents,httpmime,...)呢?

最好的情况是有下载的gradle,重新包装并以同样透明的方式链接这些库。

gradle这个:

  {相关性
    编译org.apache.httpcomponents:HttpClient的:4.2.3
    编译org.apache.httpcomponents:httpmime:4.2.3
}


解决方案

这org.apache.http简单分装到其他命名空间具有HttpClient的渲染与对股票的API编写的第三方库不兼容的缺点。有计划地创造的HttpClient 4.3返工专门为Android 4.0 BETA1的API完全兼容,并与大多数4.3功能后移植到它。这是真的减轻HttpClient的Andr​​oid的叉损伤的方式似乎是通过创建另一个叉一种耻辱。谢谢谷歌。

最新资讯结果
只有Android版,HttpClient库的阿帕奇HttpComponents创建自旋这是可以在这里:的 https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html

Using and Choosing way to make HTTP(S) requests on Android is a long-time pain.

Although Google wants us to use HttpURLConnection, there are those who prefer to use HttpClient instead.

There is this library, https://code.google.com/p/httpclientandroidlib/ with packaging script.

I'd rather use something more integrated with Android build environment.

Is there possibility to use Gradle to repackage Maven dependency (whole tree, including httpclient, httpcomponents, httpmime, ...) in the same way httpclientandroidlib does?

The best scenario would be to have gradle download,repackage and link those libraries in the same transparent way.

gradle:

dependencies {
    compile 'org.apache.httpcomponents:httpclient:4.2.3'
    compile 'org.apache.httpcomponents:httpmime:4.2.3'
}

解决方案

Simple repackaging from org.apache.http to some other namespace has a drawback of rendering HttpClient incompatible with 3rd party libraries compiled against the stock APIs. There are plans to create a re-spin of HttpClient 4.3 specifically for Android fully compatible with 4.0 BETA1 APIs and with most of 4.3 features back-ported to it. It is a shame really that the way of mitigating the damage of Android's fork of HttpClient appears to be by creating yet another fork. Thank you Google.

NEW INFO
Apache HttpComponents created spin of HttpClient library for Android only, which is available here: https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html

这篇关于摇篮重命名行家依赖包(HttpComponents,Android版)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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