Wednesday, December 19, 2012

Android Project Ant Build, and put the version in the release file

When you created one project using the eclipse android project, by default you can only build the project, export as APK through the eclipse menu.

Ant is another powerful build tool. you can convert the android project to a ant build target. then just run ant release to build the apk. here is one demo,
Give one project called FrameworkDemo
image

run android update project –p . , it will create one ant build.xml file
image

run ant release, it will create one apk under the bin file,
image

you can put the key information to the ant. properties, like
image

how ever, if you want the release file to be called projectname-youversion-release.apk, ( you can get the version from the AndroidManifest.xml

here is one quick fix. change build xml under platform/tools/ant
Add a target to extract the version informatino,
image
then reference this version
image
Now build again,
image
you can see the version in the file name.

 
Locations of visitors to this page