廢話寫在最前面
今天突然對AndroidManifest.xml文件中的VersionCode和VersionName的命名規(guī)則有些疑問枫慷,到底怎么樣的命名才是規(guī)范的呢?于是查看了幾款常用軟件的命名規(guī)則倚搬,通過豌豆莢是可以看到app的VersionCode和VersionName的,手機(jī)上也給這幾款軟件截了個(gè)圖(如下)。廢話不多說,看了參考文章就明白了狈茉。我只做個(gè)簡單的總結(jié)夫椭。
參考文章
關(guān)于版本號的總結(jié)
Android 各版本的命名規(guī)則是怎樣的掸掸?
Google官方-Version Your App
AndroidManifest:VersionCode和VersionName
更優(yōu)雅的 Android 發(fā)布自動版本號方案
Android Studio Gradle實(shí)踐之多渠道自動化打包+版本號管理
簡單總結(jié)
versionCode
— An integer used as 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
setting, below.
VersionCode,整數(shù)值蹭秋,發(fā)布第一版程序設(shè)為1扰付,每次發(fā)布依次遞增,對用戶不可見仁讨,僅用于識別版本用途羽莺。
VersionName,字符串值洞豁,對用戶可見盐固,如1.0.0荒给。
Typically, you would release the first version of your app with versionCode
set to 1, then monotonically increase the value with each release, regardless whether the release constitutes a major or minor release. This means that the versionCode
value does not necessarily have a strong resemblance to the app release version that is visible to the user (see versionName
, below). Apps and publishing services should not display this version value to users.
也就是說VersionCode理論上來說只要依次遞增就可以(你開心就好),但是一般建議從1開始刁卜。
Warning: The greatest value Google Play allows for versionCode
is 2100000000.
一種常見軟件版本號的形式是major.minor.maintenance.build:
1.項(xiàng)目初版本時(shí)志电,版本號可以為 0.1 或 0.1.0,也可以為 1.0 或 1.0.0蛔趴,如果你為人很低調(diào)挑辆,我想你會選擇那個(gè)主版本號為 0 的方式 ;
2.當(dāng)項(xiàng)目在進(jìn)行了局部修改或 bug 修正時(shí),主版本號和子版本號都不變孝情,修正版本號加 1;
3.當(dāng)項(xiàng)目在原有的基礎(chǔ)上增加了部分功能時(shí)鱼蝉,主版本號不變,子版本號加 1箫荡,修正版本號復(fù)位為 0魁亦,因而可以被忽略掉 ;
4.當(dāng)項(xiàng)目在進(jìn)行了重大修改或局部修正累積較多,而導(dǎo)致項(xiàng)目整體發(fā)生全局變化時(shí)羔挡,主版本號加 1;
5.另外吉挣,編譯版本號一般是編譯器在編譯過程中自動生成的,我們只定義其格式婉弹,并不進(jìn)行人為控制 .