How to build an Android project using Ant on the Java project?

I have an Android library project, AndroidLib, which depends on the Java project JavaLib in my workspace.

In Eclipse, this is done by JavaLib project is added to Java Build Path> to complete. AndroidLib project and set it to be exported in the Order and Export tab, and the build is normal.

However, when building AndroidLib, Ant seems to have no Get a dependency on the JavaLib project (I have run android update lib-project). What is the best way to add this dependency to build.xml?

I have the same problem. I solved it in a very hacky way. < p>

In AndroidLib/build.xml (or better in AndroidLib/custom_rules.xml), I define a -pre-build target to build JavaLib and copy the generated in libs/ jar. I also defined a -post-package target to delete the copied jar, otherwise Eclipse will get confused.









< /target>




This solution is far from satisfactory, but it gets the job done.

You will find similar questions and answers there: Android Ant Include Java Library projects

I have an Android library project, AndroidLib, which depends on the Java project JavaLib in my workspace.

In Eclipse, this is done by adding the JavaLib project to Java Build Path> to complete the AndroidLib project and set it to be exported in the Order and Export tab, and the build is normal.

However, when building AndroidLib, Ant does not seem to have access to the JavaLib project (I have run android update lib-project). What is the best way to add this dependency to build.xml?

I have the same problem. I solved this problem in a very hacky way.

In AndroidLib / In build.xml (or better in AndroidLib/custom_rules.xml), I defined a -pre-build target to build JavaLib and copied the generated jar in libs/. I also defined a -post-package target To delete the copied jar, otherwise Eclipse will be confused.














This solution is far from satisfactory, but it does the job.

You will find similar questions and answers there: Android Ant Include Java Library projects

Leave a Comment

Your email address will not be published.