如何使用依赖于Java项目的Ant构建Android项目? [英] How to build Android project with Ant that depends on Java project?
问题描述
在Eclipse中,这是通过将JavaLib项目添加到针对AndroidLib的Java 构建路径>项目,并将其设置为在订单和导出选项卡中导出,并构建良好。
但是,当构建AndroidLib(我已经运行android update lib-project)时,Ant似乎并没有提供对JavaLib项目的依赖。 将此依赖关系添加到我的build.xml中的最佳方式是什么?
回答我自己的问题:唯一的方法是正确使用不使用Ant。
- 您需要一个适当的依赖管理系统。 Maven是您唯一真正的选择。
- 您需要一个支持Maven的构建系统。我现在再次使用Maven,因为当时它是唯一的成熟的构建工具,它也支持Maven依赖关系管理 - 现在(尽管是Android图书馆项目,因为这些格式尚不是最终的)Gradle应该是你的构建
I have an Android Library project, AndroidLib, that depends on a Java project in my workspace, JavaLib.
In Eclipse this is done by adding the JavaLib project to Java Build Path > Projects for AndroidLib and setting it to be exported in the Order and Export tab, and it builds fine.
However Ant doesn't seem to pick up the dependency on the JavaLib project when building AndroidLib (I have run android update lib-project). What is the best way to add this dependency to my build.xml?
I'll answer my own question: the only way to do this properly is to not use Ant.
- You need a proper dependency management system. Maven is your only real choice here.
- You need a build system that supports Maven. I currently use Maven again for this, because at the time it was the only mature build tool that also supported Maven dependency management -- now (albeit for Android Library Projects, since the format for these is not yet final) Gradle should be your build tool of choice.
这篇关于如何使用依赖于Java项目的Ant构建Android项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!