Android application versioning through eclipse

别来无恙 提交于 2019-12-13 04:04:05

问题


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.


回答1:


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.



回答2:


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.




回答3:


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 :-)



来源:https://stackoverflow.com/questions/7788472/android-application-versioning-through-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!