Android Automated Build Increment

I was looking for a way to automatically update the AndroidManifest.xml android:versionCode & android:versionName with a new build version everytime I compiled a new build.

I wanted to go from:

android:versionCode=”1″ android:versionName =”1.0.0″


android:versionCode=”2″ android:versionName =”1.0.1″ then

android:versionCode=”3″ android:versionName =”1.0.2″ etc.

Lots of googling found that there are complicated solutions using Ant, but there wasn’t a simple “do this” solution which took 2 minutes. The best solution I found was a recommendation to script it, so I did in C# .net 2 which was a 5 minute job, so as usual took an hour. So here let me save you an hour. “Do this”:

Download AndroidBuild++

Extract the AndroidBuild++.exe somewhere such as your eclipse workspace.

In Eclipse, right click your Project from the Package Explorer on the left and choose Properties.

Choose Builders on the left.

Click the New button on the right, choose Program and click OK.

The Launch Configuration Properties will appear.  Fill it in with:

Name: “Increment Build Version”

Location: Browse File System and find the AndroidBuild++.exe that you extracted

Arguments: “${build_project}”

Don’t forget the quotes around the ${build_project}

In the Refresh tab tick – Refresh resources on completion & Specific resources

Click the Specify Resources button and choose your AndroidManifest.xml file.

Click OK and that’s it, you are done.

How it works

The Android Documentation for Versioning specifies that the versionCode should just be increased by one everytime there is a new build. This is an internal number just for you, other applications shouldn’t use it. The versionName is visible to other applications and has the format Major.Minor.Point. To me Point just means build and I just increment that value by 1. If you want to update the Major or Minor values, then just do it manually in the manifest. I guess you would do this just before releasing an update on the market.

One thing to watch out for.

If you change the versionName from “2.3.19” to “2.3.0” then when compiled it will become 2.3.1.

Instead change it to “2.3” and it will become “2.3.0”.

Also you will need .net2 installed. Pretty much everyone should have that already.

Here is the source code for the Project in Visual Studio 2010 c# .net 2 AndroidBuild++ Source Code

One thought on “Android Automated Build Increment”

Leave a Reply