Auto increment version code in Android app

So, I see it like this:

Depending on article that you present, use ant for this tasks (targets?).

  1. parse Manifest (parse XML)
  2. get old version form manifest and increase it/get version from repo
  3. store new version in manifest
  4. build android app.

But im my case I usually fill this field by value based on Tag's revision when I deploy or distribute application.