Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ant to build with android

Tags:

android

ant

I want to set up a ant build for my project. I found a tutorial saying that I need to write the following command in order to prepare for ant build:

android update project -p 

then I get the result

Updated local.properties
Updated file ./proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.

so If I try

android update project -p . --subprojects

then I get:

Updated local.properties
Updated file ./proguard-project.txt
Error: The project either has no target set or the target is invalid.
Please provide a --target to the 'android update' command.

and if I try

ant release

I get

sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var

Can some one please help me in setting up the project with ant. Thanks

like image 954
user1796624 Avatar asked Apr 25 '13 15:04

user1796624


People also ask

How do I run Ant build?

To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.

Is Android build on Java?

Android is an open source software platform and Linux-based operating system for mobile devices. The Android platform allows developers to write managed code using Java to manage and control the Android device. Android applications can be developed by using the Java programming language and the Android SDK.

What is an ant build script?

Ant is a Java-based build tool created as part of the Apache open-source project. You can think of it as a Java version of make. Ant scripts have a structure and are written in XML. Similar to make, Ant targets can depend on other targets.


1 Answers

I also had the same problem.
My problem problem got solved by the following command.

android update project --path . --subprojects --target android-19


ANT will automatically set your sdk.dir into correct one.
Don't put anything inside your local.properties.

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
like image 70
Aung Pyae Avatar answered Sep 19 '22 22:09

Aung Pyae