views:

93

answers:

1

I was wondering if it is possible to have Eclipse automatically increment the build version number inside of the Manifest each time that I either build or run an Android app.

Has anyone ever done something like this?

+4  A: 

I don't think Eclipse itself can do it, but I would imagine you could write a script that parses the manifest file and updates the number. You could set that up as a pre-build step, so every time Eclipse compiles your code, it changes the number.

My only concern with that would be that you could reach pretty big numbers, depending on how iterative your development process is. Also, this puts you at risk at forgetting to update the version string, and the users will be prompted to upgrade from version 1.0 to version 1.0.

EboMike
No reason the script couldn't update the version string too :) Do you know how to get Eclipse to run a script? I was planning on avoiding large numbers by setting it up only to run when I push it to a device/emulator.
smith324
It sure could, but I don't know if you prefer to be in control of the version string, since that is exposed to the user. You can set up build steps in the project settings. I don't have it in front of me right now, but there are basically build steps a) when building, b) when cleaning the project, and you can add any number of steps. Each step can be an arbitrary command that is executed.
EboMike