开发者

How to set builtNumber in Android

I am uploading a new application on Android Market and it warned me that the new version needs higher versionCode. But since I made just a little improvement, I didn't want to assign 开发者_开发技巧version 2 from version 1 instead I wanted to say "1.1" but versionCode doesn't allow me to type in float numbers.

So I think I can use versionName which is the one shown to the users but still I am wondering how to do it in versionCode as well.

Android doc says :

android:versionCode -

An internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName attribute.

The value must be set as an integer, such as "100". You can define it however you want, as long as each successive version has a higher number. For example, it could be a build number. Or you could translate a version number in "x.y" format to an integer by encoding the "x" and "y" separately in the lower and upper 16 bits. Or you could simply increase the number by one each time a new version is released.

But I didn't understand the second paragraph.

Thanks.


It means that

  1. only integers are valid(1, 2, 5689)

  2. you can use any integer, for example build number( it is always positive integer )

  3. to upload a new version you should use number that is higher then previous

Also, version code isn't seen by anyone, except you, so don't worry. Only version name is exposed, you can set it to any string value(with some length and rational sense restrictions).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜