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

I believe I followed the instructions in the Android SDK, and now I'm trying to create a LunarLander sample (random selection)

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

I believe all PATHs are configured correctly. I did this earlier in an older version of the Android SDK, and I know that I did not encounter this error, so I'm pretty confused as to what happened.

Oh, another piece of information - I installed the platform package 3.0, so I'm not sure if this is a bug or not.

+66
android build ant android-build
Apr 6 2018-11-11T00:
source share
4 answers

You need to execute the following command:

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

which will create the necessary build.xml file in the examples directory, then the ant debug command should work.

Take a look here .

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

+114
Apr 6 '11 at 20:19
source share

You will need to create an Ant build file using the process described here .

Starting a command line update project (should) create Ant dependency files for you.

+8
Apr 6 2018-11-21T00:
source share

android updated project been removed in SDK tools 26.0.1

Do not use Ant. It is no longer properly maintained. For now, just use the Android Studio GUI and create Gradle projects manually.

android update project was finally removed in the SDK 26.0.1 tools after a long period of aging and did not pass, for example, wth:

 The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager ************************************************************************* Invalid or unsupported command "update project -p ./bloom -t android-23" 

So now I do not know how to create a project from the CLI without Android Studio. The best workaround so far I had to create a template project using Android studio, and he copied it with a helper script, as described in: How to create an android project using Gradle from the command line?

Also, I was not able to easily import the existing Ant project into Gradle: Running Ant Build on Android Studio , so I'm just copying the sources around for now.

Up to 26.0.1

When starting a new project, you can use:

 android create project \ --target 1 \ --name MyName \ --path . \ --activity MyActivity \ --package com.yourdomain.yourproject 

which automatically creates build.xml .

These demo projects contain only gradlew files. I want Google to be able to use only one of Ant or Gradle for everything.

+2
Jan 22 '16 at 20:33
source share

Please install on ubuntu openjdk-7-jdk

 sudo apt-get install openjdk-7-jdk 

on Windows, try finding find openjdk.

-6
May 15 '13 at 11:58
source share



All Articles