AndroidManifest.xml 文件 <manifest> versionCode 屬性 (AndroidManifest.xml file <manifest> versionCode attribute)


問題描述

AndroidManifest.xml 文件 versionCode 屬性 (AndroidManifest.xml file versionCode attribute)

為您的應用程序版本化 在 Android 開發者網站上:

您將發布應用程序的第一個版本,並將 versionCode 設置為 1,然後隨著每個版本單調增加該值,無論該版本是主要版本還是次要版本。

blockquote>

這一切都很好,但是如何處理這個序列?:

 1 1.0 2 1.1 3 1.2 4 1.3 5 1.4 6 2.0 ?1.5 

參考解法

方法 1:

I presume by that sequence you are really trying to say "what if we want to release a next‑generation‑tech 2.0 but then still issue a 1.5 patch release against the 1.0 series tech?"

Your choices are:

  1. Don't do that ‑‑ once you cut over to 2.0, stay on the 2.0 series
  2. Release the 2.0 tech line as a separate app, perhaps starting over its sequence with 1
  3. Ummmm...there is no #3

My guess is you'd want #2. After all, by definition, you are saying there are two current editions of the app (1.5 and 2.0), and therefore there are, in effect, two different apps.

方法 2:

To allow multiple lines of development and release we go back to the old days of Basic line numbers. The order below is by release date:

10000 1.0‑0
10001 1.0‑1
10002 1.0‑2
10100 1.1‑0
10103 1.1‑3
10200 1.2‑0
20000 2.0‑0
10201 1.2‑1

The above limits one to 100 dot and 100 dash releases at each level (2 digits). One could use 10 per level (1 digit) but I have never worked with "real" software that would live within that restriction. Given today's constant integration methodology there are even some cases where 1000 (3 digits) would be needed per level.

Using 2 digits provides 31 major releases for signed 16 bit integer or 63 for unsigned. This should/may give the Android world enough time to go to 64 bits if need be.

This method provides for multiple branches, that can be examined by programs, with the higher versionCode numbers meaning upgrades from lower numbers.

Versioning Your Applications states:

Other applications ... need to query the system for your application's version, to determine compatibility and identify dependencies

android:versionCode — An integer value that represents the version of the application code, relative to other versions

The value is an integer so that other applications can programatically evaluate it, for example to check an upgrade or downgrade relationship. You can set the value to any integer you want, however you should make sure that each successive release of your application uses a greater value.

The issue remaining is regarding "each successive release". Is this intended to restrict one to the date of so that you cannot have both 1.2‑1 and 2.0‑0 succeed 1.2‑0 except when the release dates are in that order. versionCode values: 10200, 10201 & 20000 provide for an "upgrade or downgrade relationship". Or is the use of an integer value intended to limit one to a single line without branches?

(by CW Holeman IICommonsWareCW Holeman II)

參考文件

  1. AndroidManifest.xml file versionCode attribute (CC BY‑SA 2.5/3.0/4.0)

#versioning #Android #xml






相關問題

AndroidManifest.xml 文件 <manifest> versionCode 屬性 (AndroidManifest.xml file <manifest> versionCode attribute)

grails 插件兼容性 (grails plugins compatibility)

Debug Unit Test bằng cách sử dụng Resharper 7 cho MBUnit ném ra một ngoại lệ (Debug Unit Tests using Resharper 7 for MBUnit throws an exception)

在 Maven 依賴項中包含不同版本的庫,完全破壞了我的構建 (Including a different version of a library, in a maven dependency totally broke my build)

Servicestack nuget 版本控制 (Servicestack nuget versioning)

如何從共享庫中獲取版本信息到 Android 清單中? (How to get version info from a shared library into the Android manifest?)

我可以在 Visual Studio 中為解決方案設置通用的 major.minor.release (Can I set a general major.minor.release for a solution in Visual Studio)

跨版本的 PowerShell 安裝文件夾和腳本文件擴展名 (PowerShell installation folder and script filename extension across versions)

嚴格版本化的 WCF 服務命名空間是否應該對合同是唯一的? (Should strictly versioned WCF service namespaces be unique to the contract?)

為不同版本的 3rd 方庫設計實用程序 (Design of utilities for diffrent versions of 3rd party library)

如何檢索顯示上游狀態的 git 版本信息 (How do I retrieve git version info showing upstream state)

帶有紗線漿果的 CLI 凹凸版本號 (CLI bump version number with yarn berry)







留言討論