Unity 3D: What is the Android Bundle Version and Version Code and how do they relate?
Asked Answered
R

4

27

a) What does the Android bundle version and version code denote?

b) What is the difference between the bundle version and version code?

i) Suppose I have a bundle version of 0.137, how does the version code relate to this? Can the version code just be 137?

ii) What happens when I release bundle version 1.0 next? Can I just call the version code 10?

c) How do they relate? What's the right way to number the bundle versions?


N.B. There does not seem to be a source that explains the difference, in search. I have been very haphazardly numbering my bundles till now, but I'd like to figure out how to do this right.

These designations appear to be specific to Unity, but I am not sure if I understand what the parameters are about even from that page...

Rhinencephalon answered 15/3, 2012 at 13:0 Comment(3)
are you talking about android:versionCode and android:versionName ?Cauley
What is a "bundle version"? I am not aware of any concept in Android with that name.Hickerson
this might be a unity specific question actually ... unity3d.com/support/documentation/Components/…Rhinencephalon
I
29

There's no "bundle version". That's an iOS/Mac term. Built Android apps are called packages.

Android has two places where a version is specified: version name (android:versionName in manifest) and version code (android:versionCode). They don't have to be corellated, but in practice they usually are. Google Market uses version code (not name) when you publish an update to make sure your update is later than the package currently published.

The version name is what the end users see. There's no limitation on its format; it's a free-text string, although the vast majority of apps stick to 1.2 or 1.2.3 patterns.

The way you corellate version name and version code is up to you. You can go with sequential version codes, or you can use a major*10000 + minor*100 + build formula - that's what Google does with their apps, so that v. 4.10.3 would have code 41003.

Impermissible answered 16/3, 2012 at 17:20 Comment(1)
Good answer but the OP was asking for the Unity player settings. Bundle Version will be used to fill android:versionName. See this blog post for a deteailed explanationAmboceptor
F
18

Update

In newer versions of Unity Bundle Version became just Version. Bundle Version Code still exists. Documentation on these values can be found in the Unity docs for Android Player settings (Android Player settings > Other settings > Identification): https://docs.unity3d.com/Manual/class-PlayerSettingsAndroid.html#Identification

  • Version: Enter the build version number of the bundle, which identifies an iteration (released or unreleased) of the bundle. The version is specified in the common format of a string containing numbers separated by dots (eg, 4.3.2). (Shared between iOS and Android.)

  • Bundle Version Code: 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.

    Keep this number under 100000 if Split APKs by target architecture is enabled. Each APK must have a unique version code so Unity adds 100000 to the number for ARMv7, and 200000 for ARM64.

Original answer

Unity has the answer in their Manual of Player Settings page: http://docs.unity3d.com/Manual/class-PlayerSettings.html (Update: this link no longer contains the information below):

  • Bundle Version: Specifies the build version number of the bundle, which identifies an iteration (released or unreleased) of the bundle. The version is specified in the common format of a string containing numbers separated by dots (eg, 4.3.2). (This is shared between iOS and Android.)

  • Bundle Version Code: 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.

Felisafelise answered 2/6, 2014 at 18:5 Comment(0)
D
2

This does not directly address the question but is related (and related to the answer by ArianJM).

I came to this question as a result of a problem I just had uploading a new version to the Amazon Appstore.

The content on the referenced Unity Manual page from ArianJM has changed and (at least for version 5.4) no longer contains any information about Bundle Version or Bundle Version Code.

In Unity 5.4:

Bundle Version is now Version. This field is identified by the Amazon Appstore as Version name.

Bundle Version Code is still Bundle Version Code. This field is identified by the Amazon Appstore as Version code. This field only allows numbers.

I am in the process of uploading a new version to the Amazon Appstore and although I updated the Version in Unity to 1.1, the Bundle Version Code was not updated and as a result was rejected by the Amazon Appstore because it was the same as the previous Bundle Version Code (Version code in Amazon Appstore).

I've since updated the Bundle Version Code in Unity - but could not update it to 1.1 or 1_1 because the field is strictly numeric - and so instead updated it to 2.

Which I believe brings us full circle to one part of the original question: Is there a right way to number the bundle versions?

Although arbitrarily changing it to 2 in my case is clearly not much of a scheme - it is both different and higher than the previous number and, as such, works.

It's not much of a plan but the lack of current documentation by Unity addressing these fields - and the similar-but-different field names between Unity and the Amazon Appstore seems to lead to these ad-hoc decisions.

Downspout answered 5/8, 2016 at 15:28 Comment(1)
Note: There are two "Version"s in Player Settings. The top one next to your company name will change the android "Version" below. The "Bundle Version Code" is the important one. What Google Play Console calls "version code" is what Unity calls "Bundle Version Number".Ashy
R
0

I had a random long number in Version Code in Unity 2480382 or similar and I changed it to number 3, same as version app number and Google Play accepted it, so I guess keeping it to the same number would be safe and try not to name versions as 2.1.2 as they add extra 0s and it throws an error that your APK is high etc.. so better to keep it as 1, 2, 3

Recommend answered 26/11, 2022 at 21:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.