Creating Android applications via the command line and Apache Ant

Android projects can be created either with the ADT Plugin for Eclipse or via the command line. This blog entry explains how to do this via the command line.

You find the related command line program “android” in the folder “tools” of your Android SDK installation. Add this folder to your path and run the following command>

android create project --target "Google Inc.:Google APIs:8" --path --activity TestActivity --package 

I assume except –target all other options are clear. To see potential targets use the command

android list targets 

To compile your program you can use Apache Ant. You need of course to have Ant installed and add it to your path. See Apache Ant Tutorial for this. Afterwards switch into your newly created directory “” and type the following to create a development release

ant debug

You can also build a real release, this requires that you setup the “” and “key.alias” properties in

ant release

To install it into an running device, e.g. the emulator, use

ant install

You find now the activity “TestActivity” on your virtual device under programs and you can test it.

I hope this help. Enjoy your Android Development.

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Android and tagged , , . Bookmark the permalink.