简体   繁体   English

Gradle重命名Maven依赖包(HttpComponents,Android)

[英]Gradle rename maven dependency package (HttpComponents, Android)

Using and Choosing way to make HTTP(S) requests on Android is a long-time pain. 使用和选择在Android上发出HTTP(S)请求的方法是一个长期的难题。

Although Google wants us to use HttpURLConnection, there are those who prefer to use HttpClient instead. 尽管Google希望我们使用HttpURLConnection,但是有些人更喜欢使用HttpClient。

There is this library, https://code.google.com/p/httpclientandroidlib/ with packaging script. 有一个带有打包脚本的库https://code.google.com/p/httpclientandroidlib/

I'd rather use something more integrated with Android build environment. 我宁愿使用与Android构建环境更集成的东西。

Is there possibility to use Gradle to repackage Maven dependency (whole tree, including httpclient, httpcomponents, httpmime, ...) in the same way httpclientandroidlib does? 是否有可能使用Gradle重新包装Maven依赖项(整个树,包括httpclient,httpcomponents,httpmime等),方法与httpclientandroidlib一样?

The best scenario would be to have gradle download,repackage and link those libraries in the same transparent way. 最好的方案是使用相同的透明方式进行gradle下载,重新打包和链接这些库。

gradle: 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. 从org.apache.http到其他名称空间的简单重新打包具有使HttpClient与根据常规API编译的第三方库不兼容的缺点。 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. 有计划创建专门针对Android的HttpClient 4.3的重新设计版本,该客户端与4.0 BETA1 API完全兼容,并且具有向后移植到其中的大部分4.3功能。 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. 减轻Android的HttpClient分支的损坏的方法似乎是通过创建另一个分支,真是可耻。 Thank you Google. 谢谢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 Apache HttpComponents仅针对Android创建了HttpClient库的自旋,可在此处找到: https : //hc.apache.org/httpcomponents-client-4.3.x/android-port.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM