I finally found a solution here .
It was for SVN, but it was easy enough to configure for Bazaar ...
This is what my task looks like.
<property environment="env"/> <target name="bzr-revision"> <echo>Modifying Android manifest with revision: ${env.BZR_REVISION}</echo> <replaceregexp file="AndroidManifest.xml" match='android:versionName="([^".]+\.[^".]+\.[^".]+)(\.[^"]*)?"' replace='android:versionName="\1.r${env.BZR_REVISION}"'/> </target>
If versionName is 1.5.2, il will replace it with 1.5.2.r123 (where 123 is the revision number of Bazaar). You can customize the regular expression to your needs.
source share