简体   繁体   English

Android - 应用更新清单版本代码和名称

[英]Android - App Update Manifest Version Code and Name

my Android Manifest File : 我的Android清单文件:

my existing Version Code = 1 我现有的版本代码= 1

also

my existing Version Number = 1 我现有的版本号= 1

I want to update my App and I know that have to change my Version Number eg to 1.1 but what does the Version Code mean? 我想更新我的应用程序,我知道必须将我的版本号更改为1.1,但版本代码是什么意思?

  • Should it stay at 1? 它应该保持在1吗?

Or do i have to change it also? 或者我是否也要改变它? Maybe be to 2? 也许是2? oder anything else? 还有其他什么?

Thx for ur help! 谢谢你的帮助!

Version Code is important. 版本代码很重要。 It indicates a release number. 它表示版本号。 1= first release, 2 = second release etc of your APK. 1 =您的APK的第一次发布,2 =第二次发布等。

Version number is a display version that shows major minor release versions. 版本号是显示主要次要版本的显示版本。

android:versionCode — An integer value that represents the version of the application code, relative to other versions. android:versionCode - 一个整数值,表示相对于其他版本的应用程序代码的版本。 The value is an integer so that other applications can programmatically 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 system does not enforce this behavior, but increasing the value with successive releases is normative. 系统不会强制执行此行为,但通过连续发布增加值是规范性的。 Typically, you would release the first version of your application with versionCode set to 1, then monotonically increase the value with each release, regardless whether the release constitutes a major or minor release. 通常,您将释放应用程序的第一个版本,并将versionCode设置为1,然后随每个版本单调增加值,无论该版本是主要还是次要版本。 This means that the android:versionCode value does not necessarily have a strong resemblance to the application release version that is visible to the user (see android:versionName, below). 这意味着android:versionCode值不一定与用户可见的应用程序发行版本具有很强的相似性(请参阅下面的android:versionName)。 Applications and publishing services should not display this version value to users. 应用程序和发布服务不应向用户显示此版本值。

android:versionName — A string value that represents the release version of the application code, as it should be shown to users. android:versionName - 一个字符串值,表示应用程序代码的发行版本,因为它应该向用户显示。 The value is a string so that you can describe the application version as a .. string, or as any other type of absolute or relative version identifier. 该值是一个字符串,以便您可以将应用程序版本描述为..字符串,或任何其他类型的绝对或相对版本标识符。 As with android:versionCode, the system does not use this value for any internal purpose, other than to enable applications to display it to users. 与android:versionCode一样,系统不会将此值用于任何内部目的,除了使应用程序能够将其显示给用户。 Publishing services may also extract the android:versionName value for display to users. 发布服务还可以提取android:versionName值以显示给用户。

Source: http://developer.android.com/tools/publishing/versioning.html 资料来源: http//developer.android.com/tools/publishing/versioning.html

but what does the Version Code mean? 但版本代码是什么意思?

It is how the OS, the marketplaces (Play Store, etc.), and other tools determine whether or not your APK represents an upgrade. 操作系统,市场(Play商店等)以及其他工具决定您的APK是否代表升级。

Quoting the documentation : 引用文档

Typically, you would release the first version of your application with versionCode set to 1, then monotonically increase the value with each release, regardless whether the release constitutes a major or minor release. 通常,您将释放应用程序的第一个版本,并将versionCode设置为1,然后随每个版本单调增加值,无论该版本是主要还是次要版本。 This means that the android:versionCode value does not necessarily have a strong resemblance to the application release version that is visible to the user (see android:versionName , below). 这意味着android:versionCode值不一定与用户可见的应用程序发行版本具有很强的相似性(请参阅下面的android:versionName )。

If your app is already published with an android:versionCode of 1 , your next upgrade needs to have an android:versionCode higher than 1 . 如果你的应用已经发布了android:versionCode1 ,你的下一次升级需要有一个android:versionCode高于1

The version code is a code used not to presentation but for inner use. version code是用于不用于呈现但用于内部使用的代码。 for example, to update a new version to the google play - you'll have to increase it by 1 at least. 例如,要将新版本更新为Google Play,您必须至少增加1。 Another example - the Android application DB will get the onUpdate method pop if this version code is greater then the previous one. 另一个例子 - 如果此版本代码大于前一个版本代码,Android应用程序DB将弹出onUpdate方法。

Each time you publish a new version to the Google Play, you have to increment your version code. 每次将新版本发布到Google Play时,都必须增加版本代码。 So, here it will be 2. 所以,这里将是2。

Regards, 问候,

As it says on the official docs at http://developer.android.com/tools/publishing/versioning.html : 正如它在http://developer.android.com/tools/publishing/versioning.html上的官方文档中所述:

android:versionCode — An integer value that represents the version of the application code, relative to other versions. android:versionCode - 一个整数值,表示相对于其他版本的应用程序代码的版本。 The value is an integer so that other applications can programmatically evaluate it. 该值是一个整数,以便其他应用程序可以以编程方式对其进行评估。

android:versionName — A string value that represents the release version of the application code, as it should be shown to users. android:versionName - 一个字符串值,表示应用程序代码的发行版本,因为它应该向用户显示。 The value is a string so that you can describe the application version as a <major>.<minor.>point> string, or as any other type of absolute or relative version identifier. 该值是一个字符串,以便您可以将应用程序版本描述为<major>。<minor。> point>字符串,或任何其他类型的绝对或相对版本标识符。 As with android:versionCode, the system does not use this value for any internal purpose 与android:versionCode一样,系统不会将此值用于任何内部目的

So I guess you should come with your own numbering scheme. 所以我猜你应该带着自己的编号方案。 For example, you could use 9 digit scheme, with 3 3-digit pieces for <major>.<minor.>point>. 例如,您可以使用9位数的方案,其中3个3位数的部分用于<major>。<minor。> point>。 In this case, 1.1.0 would be 001001000, and then 1.1.1 would be 001001001 and so on. 在这种情况下,1.1.0将是001001000,然后1.1.1将是001001001,依此类推。 This guarantees that you can compare the number directly to know if a version is older or newer. 这可以保证您可以直接比较数字,以了解版本是旧版本还是更新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM