Http://xmagicj.diandian.com/post/2011-11-22/7022215
Automatically compile the build. xml file using the android command
Purpose: Perform automatic integration and compilation environment.
I won't talk about environment matching (SDK/environment variables ).
Enter the CMD interface.
Enter the project directory.
Input:Android. Bat list targetTo query our existing version list.
Remember this ID number, which will be used in the following code.
Input:Android update project-N buttondemo-T 1-p e: \ workspace \ Android \ buttondemo
-NCorresponding to the project name
-TIt is the ID corresponding to the SDK version we have previously queried. You can make a selection based on your project version. This is Android-8, so Id 1 is used.
-PIs the generated path
After successful display:
The following is the generated build. XML code snippet:
<? XML version = "1.0" encoding = "UTF-8"?>
<Project name = "buttondemo" default = "help">
<! -- The local. properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It shoshould not * be checked
Version Control Systems. -->
<Loadproperties srcfile = "Local. properties"/>
<! -- The Ant. properties file can be created by you. It is only edited by
'Android' tool to add properties to it.
This is the place to change some ant specific build properties.
Here are some properties you may want to change/update:
Source. dir
The name of the source directory. Default is 'src '.
Out. dir
The name of the output directory. Default is 'bin '.
For other overridable properties, look at the beginning of the Rules
Files in the SDK, at tools/ANT/build. xml
Properties related to the SDK location or the project target shocould
Be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
Application and shoshould be checked into version control systems.
-->
<Property file = "ant. properties"/>
<! -- The project. properties file is created and updated by the 'android'
Tool, as well as ADT.
This contains project specific properties such as project target, and library
Dependencies. Lower Level build properties are stored in ant. Properties
(Or in. classpath for eclipse projects ).
This file is an integral part of the build system for your
Application and shoshould be checked into version control systems. -->
<Loadproperties srcfile = "project. properties"/>
<! -- Quick check on SDK. dir -->
<Fail
Message = "SDK. DIR is missing. Make sure to generate local. Properties Using 'android update project '"
Unless = "SDK. dir"
/>
<! -- Extension targets. uncomment the ones where you want to do custom work
In between standard targets -->
<! --
<Target name = "-Pre-build">
</Target>
<Target name = "-Pre-compile">
</Target>
/* This is typically used for code obfuscation.
Compiled code location: $ {out. classes. Absolute. dir}
If this is not done in place, override $ {out. Dex. Input. Absolute. dir }*/
<Target name = "-post-compile">
</Target>
-->
<! -- Import the actual build file.
To customize existing targets, there are two options:
-Customize only one target:
-Copy/paste the target into this file, * Before *
<Import> task.
-Customize it to your needs.
-Customize the whole content of build. xml
-Copy/paste the content of the rules files (minus the top node)
Into this file, replacing the <import> task.
-Customize to your needs.
***********************
****** Important ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
In order to avoid having your file be overridden by tools such as "android Update Project"
-->
<! -- Version-Tag: 1 -->
<Import file = "$ {SDK. dir}/tools/ANT/build. xml"/>
</Project>