Pre-Requisites:1. Jdk 1.6 or later. Set JAVE_HOME to location of the Jdk.
2. In the Android installation directory there are tools and platform-tools folder. Append the path of these folders to the PATH environment variable.
3. Download apache-ant from http://ant.apache.org/. I have downloaded apache-ant-1.8.4.zip.
4. Extract apache-ant-1.8.4.zip file at any drive at root level.
5. Add apache-ant/bin to PATH environment variable or at command prompt use the following command: set PATH=" D:\apache-ant-1.8.4\bin";%PATH%
How to add build.xml file to existing Android project?It is really simple and easy to add an Ant script file, build.xml, to your existing Android project. Following are the steps:
From command prompt navigate to the root directory of your project.
>android update project –p <path>
Note that the above android command will only work if you have properly set the Android sdk’s tools and platform-tools folder to the PATH environment variable (as mentioned above in Pre-Requisites Step 2).
Build the Android project using Ant ScriptThis step is really simple, if you have properly set thevvpath of apache-ant/bin folder (as mentioned in Pre-Requisites Step 5).
Enter the following command while you are at the root directory of your Android project:
>ant clean command, clean the project
Please follow my next post Create Signed Build of Android Application using Ant Script if you want to create a signed .apk file of your Android application.