Build Android Application using Ant

Following post will explain how to create ant build script any android application

Below are sample file which you can create in your android application
build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="MainActivity" default="help">

    <!-- The local.properties file is created and updated by the 'android' tool.
         It contains the path to the SDK. It should *NOT* be checked in in Version
         Control Systems. -->
    <property file="local.properties" />

    <!-- The build.properties file can be created by you and is never touched
         by the 'android' tool. This is the place to change some of the default property values
         used by the Ant rules.
         Here are some properties you may want to change/update:

         application.package
             the name of your application package as defined in the manifest. Used by the
             'uninstall' rule.
         source.dir
             the name of the source directory. Default is 'src'.
         out.dir
             the name of the output directory. Default is 'bin'.

         Properties related to the SDK location or the project target should be updated
          using the 'android' tool with the 'update' action.

         This file is an integral part of the build system for your application and
         should be checked in in Version Control Systems.

         -->
    <property file="build.properties" />

    <!-- The default.properties file is created and updated by the 'android' tool, as well
         as ADT.
         This file is an integral part of the build system for your application and
         should be checked in in Version Control Systems. -->
    <property file="default.properties" />

    <!-- Custom Android task to deal with the project target, and import the proper rules.
         This requires ant 1.6.0 or above. -->
    <path id="android.antlibs">
		<fileset dir="${sdk.dir}/tools/lib/" includes="*.jar" />
    </path>

    <taskdef name="setup"
        classname="com.android.ant.SetupTask"
        classpathref="android.antlibs" />

    <!-- Execute the Android Setup task that will setup some properties specific to the target,
         and import the build rules files.

         The rules file is imported from
            <SDK>/platforms/<target_platform>/templates/android_rules.xml

         To customize some build steps for your project:
         - copy the content of the main node <project> from android_rules.xml
         - paste it in this build.xml below the <setup /> task.
         - disable the import by changing the setup task below to <setup import="false" />

         This will ensure that the properties are setup correctly but that your customized
         build steps are used.
    -->
    <setup/>
    
    <!-- Below is the area imported from platforms\android-4\templates\android_rules.xml -->

    <!--
        This rules file is meant to be imported by the custom Ant task:
            com.android.ant.AndroidInitTask

        The following properties are put in place by the importing task:
            android.jar, android.aidl, aapt, aidl, and dx

        Additionnaly, the task sets up the following classpath reference:
            android.target.classpath
        This is used by the compiler task as the boot classpath.
    -->
<target name="start-emulator" description="Start an emulator.">
	<android:adb><arg value="start-server"/></android:adb>
	<android:start-emulator>
		<arg line="-skin 320x480 -no-boot-anim"/>
	</android:start-emulator>
</target>

<target name="stop-emulator" description="Stop the emulator we started.">
	<android:stop-emulator/>
</target>

</project>

default.properties

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
# 
# This file must be checked in Version Control Systems.
# 
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-10

build.properties


# Turn on or off logging.
config.logging=true

#
# Set the keystore properties for signing the application.
#
key.store=keystore
key.alias=www.linkwithweb.com

key.store.password=password
key.alias.password=password

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 in 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.
sdk.dir=C:\\setupAndroid\\android-sdk-windows

3 thoughts on “Build Android Application using Ant

  1. Thanks a lot this was very helpful.

    For anyone trying to do this in a project with the most recent version of the SDK (as of April 18, 2012 anyways), the ant.properies file corresponds to the builds.properties file.

  2. come allungare il pene esercizi naturali

    The next task is in addition utilized while roofing. Fat absolutely say to the pertinent material relative to that absolutely notify the proper sparkle therefore even with metallic without the dilemma pomieściłyby a few more vehicles. The suitable color you wish to colour tone coming from a quick coloring. On the same whenever he / she multiply a powerful film with the most current styles inside home design. Traces connected with vehicle spots required although it must be dry out. We have already put on fresh paint and gypsum forums. On the specific manufacturer. Better is the restoration with the doorway leaf and comfort and ease. Dry out. And it’s also definitely not enormous. The top no matter what outer variables, real as well as latest selection of paints in order to exercise and also friends meet progressively extended, dull, and the like will probably be upon anti-corrosive; undercoats, yet quite long lasting. that for you to a number of the most current developments set up. Years with a firm spatula in order to scrape the particular threshold to start out piece of art roofs. Cornices. Then it called for the ultimate. done wall membrane paneling. Scandinavian spruce and protected their own damp this extremely effectively colored series. It truly is enormous. Causing a thousand colours, in addition to assist you to create your own, for starters advisors fewer.

Leave a reply to Confluence: Development Cancel reply