In this tutorial, I will show you how to build an application APK file from command line.
Generate the Ant Scripts
This needs to be done only once per project. From the main application project folder, run this command:
~/ADT/sdk/tools/android update project --path .
Where ADT stands for the folder where you have Android ADT extracted. This will create the build.xml file.
If you have any library project, repeat the above step to generate the build.xml file.
Fix File Permission
The version of Ant that ships with Eclipse doesn’t have executable permission enabled. Let’s fix that.
chmod a+x ~/ADT/eclipse/plugins/org.apache.ant_1.8.3.v201301120609/bin/ant
Build the Project
From the main application project folder, run Ant:
This will create the APK file in the bin/ folder.