0

I know that the application version is defined in the manifest xml file, but is there any tool to set the version number in Eclipse, without manually changing the manifest itself? Thanks.

iCantSeeSharp
  • 3,880
  • 4
  • 42
  • 65
  • I use ant script to increase build number. extract version -> increase build number part -> put new version number to manifest xml file. If you want this, I would post as anser. But this code is very complex, so whenever I read my script, I should anaysis my own script. :( – kingori Oct 17 '11 at 01:11

3 Answers3

3

I use an ant script and xmltask to update the build number in my manifest. This is the target:

<target name="update.build.number">
    <xmltask source="AndroidManifest.xml" dest="AndroidManifest.xml">
        <replace path="manifest/@android:versionName"
                 withText="1.0.${buildnum}"/>
    </xmltask>
</target>

This sets the version name to 1.0.xxx where xxx is passed into ant in the buildnum property. You could just as easily update the version number instead. If you can come up with a way to create and increment a build number this should be easy to adapt.

goto10
  • 4,370
  • 1
  • 22
  • 33
2

It depends on how you define 'manually'.

If you double click the AndroidManifest.xml file in eclipse (and you have your environment set up properly), you should get a GUI with all of the options you can select. One of them on the leftmost tab is to change the version number, both the version name, and the version code.

Edit: To be more precise:

  1. Open the GUI AndroidManifest.xml editor.
  2. Click on the Manifest Tab
  3. In Manifest General Attributes you should see version code and version name.
Leif Andersen
  • 21,580
  • 20
  • 67
  • 100
  • I define manually as "editing the xml source", so i think that your answer must be what I was told to look for. Thanks. – iCantSeeSharp Oct 17 '11 at 01:13
0

I did my own Java tool to do. Available here: android manifest build number

Features:

  • versionName is supposed to be major.minor.point (as advised by Android doc)
  • versionName can be preserved, reset to 1.0.0, or incremented (one single part of it and trailing part(s) is/are set to 0)
  • versionCode will be replaced by Unix Time

Hope this help :-)

Community
  • 1
  • 1
Pascal
  • 15,257
  • 2
  • 52
  • 65