Quick tip - git commit id as your Android app's version

Recent versions of the Android build tools have made it very easy to dynamically set the version.name (or the version.code I guess) with just ant and the command line.

Remove the version.name attribute from your AndroidManifest.xml file, and add this stanza to a custom_rules.xml file.

<exec executable="git" outputproperty="version.name">
  <arg value="rev-parse"/>
  <arg value="--short"/>
  <arg value="HEAD"/>
</exec>

Edit to taste - that's it.