How to build the Android sample projects using Ant? build.xml does not exist

Kyle picture Kyle · Apr 6, 2011 · Viewed 42.3k times · Source

I believe I've followed the instructions in the Android SDK, and I'm now trying to build the sample LunarLander (random one picked)

$ cd samples/android-11/LunarLander
$ ant debug
Buildfile: build.xml does not exist!
Build failed

I believe all PATHs are setup correctly. I've done this before in an older Android SDK release and I know I didn't encounter this error, so I'm pretty confused as to what's wrong.

Oh, one more piece of info -- I have only installed the 3.0 platform package, so I'm not sure if that is an error or not.

Answer

javanna picture javanna · Apr 6, 2011

You need to execute this command:

android update project --target <your build target> --path <path to LunarLander example>

which will create the needed build.xml within the example directory, then the ant debug command should work.

Take a look here.

*You can use android list targets to choose what build target to use for your project.