Use this example. You need to pass sdk.dir to ant, i.e. ant -Dsdk.dir=<path to Android SDK>
You also need to specify one of the seven target build goals for Android, because the default build goal is "help."
If you just run ant -Dsdk.dir=<path to Android SDK> , you will get some help, for example:
help: [echo] Android Ant Build. Available targets: [echo] help: Displays this help. [echo] clean: Removes output files created by other targets. [echo] compile: Compiles project .java files into .class files. [echo] debug: Builds the application and signs it with a debug key. [echo] release: Builds the application. The generated apk file must be [echo] signed before it is published. [echo] install: Installs/reinstalls the debug package onto a running [echo] emulator or device. [echo] If the application was previously installed, the [echo] signatures must match. [echo] uninstall: Uninstalls the application from a running emulator or [echo] device.
CREATE SUCCESSFULL Total Time: 7 seconds To create an APK, you must specify a debug or release.
ant -Dsdk.dir=<path to Android SDK> debug
This will help you create an apk file.
source share