Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set app's version number in Android Studio

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?

like image 726
rihe Avatar asked Sep 18 '15 00:09

rihe


People also ask

Where is app version number Android?

Tap the app's name to open its Properties in the Google Play Store. Now, scroll down to About this app and tap that section. On the following screen, scroll all the way down again. This will take you to an App info section.

How do I name an app version?

As you may know, on android you have to define two version fields for an app: the version code (android:versionCode) and the version name (android:versionName). The version code is an incremental integer value that represents the version of the application code.

Can I change application ID in Android Studio?

Select Android on the top left of the Project window. So, right click over your package name under Java folder and select "Refactor" -> Rename... Click in Rename Package Button. Type the name of the new package you want, mark all options then confirm.

How do you control the application version update to specific number of users?

Click on the app that you want the information and go to Statistics on the left menu. Now, you have a graph on your page. You can select the type of stats you want to see on the top in the middle, keep "Installs on active devices" selected. Right below that, you have another dropdown on "Android version".


1 Answers

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.

like image 126
Varundroid Avatar answered Sep 19 '22 06:09

Varundroid