Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automate version code incrementing in AndroidManifest?

I have application which uploaded into Subversion/SVN repo. Is it possible to use script to somehow change application version code stored in AndroidManifest? I mean during/after checkout/update?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="mypackage"
          android:versionCode="100000"
          android:versionName="1.0">
like image 654
Barmaley Avatar asked Feb 08 '11 11:02

Barmaley


1 Answers

SVN has keyword substitution which you can use to put the revision number in a file. However, this will result in the revision when the manifest file itself was last changed, which is not what you want.

The best way to achieve what you want is to call svnversion from your build script, and embed the output in the manifest file from there. You could have a manifest.template file under version control which can be used by your build script to generate the real manifest file. Put a placeholder word in the template and replace it by the revision number obtained with svnversion.

edit: in Eclipse you would probably use an Ant script, and invoke it before the normal build. The linked example generates a class file with the revision number, but you could also generate a manifest file in a very similar way.

like image 158
Wim Coenen Avatar answered Oct 19 '22 18:10

Wim Coenen