versionCode vs versionName in Android Manifest

196,485

Solution 1

Reference Link

android:versionCode

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. [...]

android:versionName

The version name shown to users. This attribute can be set as a raw string or as a reference to a string resource. The string has no other purpose than to be displayed to users. The versionCode attribute holds the significant version number used internally.

Reading that it's pretty clear that versionName is just something that's shown to the user, versionCode is what matters. Just keep increasing it and everything should be good.

Solution 2

Dont need to reverse your steps. As you increased your VersionCode, it means your application has upgraded already. The VersionName is just a string which is presented to user for user readability. Google play does not take any action depending on VersionName.

Solution 3

Version Code - It's a positive integer that's used for comparison with other version codes. It's not shown to the user, it's just for record-keeping in a way. You can set it to any integer you like but it's suggested that you linearly increment it for successive versions.

Version Name - This is the version string seen by the user. It isn't used for internal comparisons or anything, it's just for users to see.

For example: Say you release an app, its initial versionCode could be 1 and versionName could also be 1. Once you make some small changes to the app and want to publish an update, you would set versionName to "1.1" (since the changes aren't major) while logically your versionCode should be 2 (regardless of size of changes).

Say in another condition you release a completely revamped version of your app, you could set versionCode and versionName to "2".

Hope that helps.

You can read more about it here

Solution 4

Version code is used by google play store for new update. And version name is displayed to the user. If you have increased version code then update will be visible to all user.

For more detailed inform you give 2 minute reading to this article https://developer.android.com/studio/publish/versioning.html

Solution 5

I'm going to give you my interpretation of the only documentation I can find on the subject.

"for example to check an upgrade or downgrade relationship." <- You can downgrade an app.

"you should make sure that each successive release of your application uses a greater value. The system does not enforce this behavior" <- The number really should increase, but you can still downgrade an app.

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 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. 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). Applications and publishing services should not display this version value to users.

Share:
196,485

Related videos on Youtube

user838522
Author by

user838522

Updated on February 21, 2022

Comments

  • user838522
    user838522 about 2 years

    I had my app in the android market with version code = 2 and version name = 1.1

    However, while updating it today, I changed the version code = 3 in the manifest but by mistake changed my version name to 1.0.1 and uploaded the apk to the market.

    Now, will the users of my app get an update notification on their phones or not? Or should I redo the process again?

    • MPG
      MPG almost 9 years
      try this link it will help you .. " developer.android.com/tools/publishing/…"
    • superUser
      superUser almost 9 years
      They should, as you increased the version code. Which in theory is the one used as updater marker.
    • xarlymg89
      xarlymg89 almost 6 years
      @user838522 could you please mark the most voted answer as the selected answer?
    • serv-inc
      serv-inc almost 6 years
      @CarlosAlbertoMartínezGadea: user838522 was last seen in 2013
  • user838522
    user838522 about 12 years
    So can I just leave it at this? Because I think the android system checks for app updates based on Version Code instead of version number. Correct me if I'm wrong.
  • Vinil Chandran
    Vinil Chandran about 8 years
    That means no mathematical relation between both. Is it?
  • E. Sundin
    E. Sundin about 8 years
    That explains silent updates which appears to be the same version.
  • Atul
    Atul over 7 years
    Only to add a note: The greatest value Google Play allows for versionCode is 2100000000
  • Sivaram Boina
    Sivaram Boina over 6 years
    Is it mandatory to mantain the version code difference between updated vesrion and previous version of app in the play store to be 1?
  • Unknown
    Unknown over 4 years
    @sivaram No. Not at all.
  • Jeppe
    Jeppe almost 3 years
    "Say in another condition you release a completely revamped version of your app, you could set versionCode and versionName to "2"." If versionCode at this point was 137, are you then still allowed to set versionCode to 2?
  • Mudassir
    Mudassir about 2 years
    @VinilChandran! Yes, there is no mathematical relation between both. But it is a good practice to make a relation between both for self understanding in future. like versionCode:1 versionName:1.0, versionCode:2 versionName:1.1 etc