Gradle rename maven dependency package (HttpComponents, Android)

前提是你 提交于 2019-12-24 16:25:30

问题


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'
}

回答1:


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



来源:https://stackoverflow.com/questions/19361128/gradle-rename-maven-dependency-package-httpcomponents-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!