Android Ant(Application)

Do you want to build Android Application by ant?

Create build.xml

I explained the situation when we use Eclipse.
We have 2 choices

  • Export builfile

Export buildfile

We can use Eclipse export feature.
“Project right click” -> “Export” -> “Android buildfile”

Warning : “The build class path order of the source directories of project library is not correct. Exported Ant buildfile will not compile your sources correctly until you swap the order of these directories:
gen<->src”

I could not figure out what’s wrong.

Convert ant project

Move to project root in console

android update project -p .

Use android command tool

The changes are added local.properties and build.xml.
Nothing about source codes.
Automatically

What does it do?

build.xml which is generated from android tool is very simple.
Just call android SDK ant tool.

The location is under ANDROID_HOME/tools/ant/build.xml ( ANDROID_HOME is your Android SDK root)
The task list

Command Description
help Help
clean Remote output files
debug Debug build(signed a debug key) create apk
release Release build(no signed)
instrument Build an instrument package and signs debug key
test Run tests
emma
install
installd
installr
installi
installt
uninstall

Example

ant debug

Create debug build in bin/