I’m trying to get a handle on this whole “Ant” buildsystem thing. I’ve created a build.xml that Android natively gives me by using the command: android update project -p . .
While this has given me a template build.xml file, I would like a couple more options. Specifically, I would like to be able to JAR and/or Compile my project; preferably with a version number.
Bonus Question: How can I exclude files from my JAR build. For example, I have one activity that I’ve used to test my functionality, but I don’t want that to be included in the final JAR.
My build.xml file that Android has given me is Gisted here since it’s pretty long (mostly comments).
EDIT: I’m also using IntelliJ so no Eclipse specifics, please!
In Android, version numbers are for apps, not JARs.
That being said, adding a
jartarget is a matter of adding this to yourbuild.xmlfile towards the bottom:Then, run
ant jarto compile and package the JAR file.You will see this pattern in most of the reusable Android components in my GitHub area (see the
cwac-repos).Use
excludesorexcludesfile, as described in thejarAnt task documentation.