如何使用与Android捆绑在一起的版本不同的库? [英] How to use library with different version then one bundled with Android?
问题描述
我想在我的应用程序中使用最新的HttpClient 4.1版本.但是Android已经与HttpClient捆绑在一起.
I want to use the latest HttpClient 4.1 version in my application. But Android already bundled with HttpClient.
我看到的唯一方法是从源代码构建此库,然后更改程序包名称.
The only way that I see is to build this library from sources, and change package name.
还有其他解决方法吗?
在下载页面中,我看到了OSGi软件包.我没有使用OSGi的经验,但是AFAIK,OSGi旨在解决库版本控制问题?如果可以,该如何使用?
At download page I see OSGi bundle. I have no experience in using OSGi, but AFAIK, OSGi intended to solve libraries versioning problems? If so, how can I use it?
推荐答案
您可以使用Maven Shade插件将所有类移至另一个包,然后从那里使用它. http://maven.apache.org/plugins/maven-shade-plugin/
You can use the Maven Shade Plugin to move all classes to a different package and then use it from there. http://maven.apache.org/plugins/maven-shade-plugin/
如果这样做,最简单的方法就是也使用Maven Android插件使用Maven构建应用程序.
If you do that the easiest will be to also build you application with Maven using the Maven Android Plugin http://code.google.com/p/maven-android-plugin/
这篇关于如何使用与Android捆绑在一起的版本不同的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!