5

I've searched through stackoverflow and this doesn't seem to be a duplicate question, so please notify me if it has already been asked. I've made a second version of an app and I was wondering if there was a naming convention for the app versions. In my gradle, I've changed the values of versionCode and versionName to

versionCode 2
versionName "1.0.2"

Is this the right convention? Is there even a convention? Does versionCode have to be an integer? Is 1.02 or 1.0.02 acceptable? And does it have to be by increments of 1(i.e. can I jump straight to 1.7 on the second update)?(sorry for all the questions, I wanted to get all of it at once.)

Luke Wang
  • 133
  • 9

2 Answers2

5

versionCode have to be integer, and it is used for android to keep track of which apk is latest, e.g. in Google Play, you can upload your apk if your new apk has versionCode larger than that of the apk you previously uploaded.

versionName is for display only, and communication with user, it is up to you to define it. I.e. no restriction

Derek Fung
  • 7,947
  • 1
  • 22
  • 28
0

There are no literal restrictions on either, just their data types: versionCode can be any integer and versionName can be any string.

However, Android uses the versionCode to tell which builds are more recent - and doesn't let users install an apk if the versionCode of the apk to install is less than the versionCode of the apk already installed.

Therefore version code changes should always be to larger numbers - though the how much larger is technically irrelevant.

versionName is for display purposes only. It could be set to "v1.43 - blueVersion attempt4".

A common naming conversion is to label each release version major.minor.fix in the version name, and then reflect it in the version code. e.g. v "2.3.11" becomes version code 20311. which could be followed by v"3.0.0" = code 30000.

Moffen
  • 1,435
  • 1
  • 8
  • 24