33

I would like to upgrade an app's version number (that is displayed in the Play Store) in Android Studio, but I'm not an Android developer so I'm not sure what I'm doing is right. I googled how to do it, and the Android guide says I should have to do it in the AndroidManifest.xml, but I can't find android:versionCode, android:versionName in that file. However I found these lines in the build.gradle:

minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.1"

The actual version number is 1.1 in the Play Store, so I assume I got this, but I would really appreciate if somebody could confirm it for me. So is it enough if I edit only the versionName in the build.gradle? Or do I need to do anything else? What is the common practice to do this?

2 Answers 2

54

Yes, every time you release an update on PlayStore you need to update these two lines in your gradle file by incrementing the digits in front of them -

versionCode 1
versionName "1.1"

Your versionCode should always be incremented but versionName is totally up to you when you plan to release an update. I usually increment my versionName based on how big is the update that I'm releasing.

  • If its a huge update to the previous version like new UI OR too many new features then I increment versionName by 1 and change it to 2.0, 2.1 etc

  • If its a small one, for instance I fixed few bugs then I usually increment versionName to 1.1.1, 1.1.2 etc.

  • If its just one new feature or I changed some vital content in my app then I increment the versionName to 1.2, 1.3 etc.

For ex. Minimum increment from versionCode 1 and versionName 1.1 can be -

versionCode 2
versionName "1.1.1"

You can find more info here - Versioning an Android app. Just keep in mind this document still explain versioning using AndroidManifest which still works but not recommended anymore as the values will be overridden by values in gradle file.

NOTE

As CommonsWare mentioned in his comment, you can change your versionCode to be something meaningful like date or anything that makes more sense to you. Play store will not raise any issue till the time its an integer and the newer one is higher than the older one.

4
  • 7
    "Your version code should be increment by 1" -- technically, so long as the new one is higher than the old one, they do not need to be incremented in units of 1. If you wanted the versionCode to be the release date in YYYYMMDD format, that would work, as that would be a valid integer, for example. Commented Sep 18, 2015 at 0:23
  • So I'm fine with versionCode 2 and versionName "1.2"?
    – rihekopo
    Commented Sep 18, 2015 at 0:24
  • @CommonsWare Thanks for the info. I usually stick with digits and never tried dates so far.
    – Varundroid
    Commented Sep 18, 2015 at 0:33
  • 1
    VersionCode is an integer thus 1.1 will not work, and the versionName is not required to be changed for upload on play store (although you should always change it)...
    – Distwo
    Commented Sep 18, 2015 at 0:59
6

You are right, versionName is the displayed version, versionCode is an integer that need to be incremented between each release to the play store.

These use to be set in the manifest but have been moved to the build.gradle with android studio.

FYI, if you put them back to the manifest it will still work but will be overridden by the build.gradle values if any are found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.