Why versioning your app is important

Consider the following situations:

  • There is a problem with your app, i.e. you have noticed some bug in it

  • Users have requested new features or services to be added to your app

  • Users have asked you to improve upon one of the app’s features

In such cases you will need to upgrade your app and provide users with a new version. The process of delivering a new version to users could have been a tough one. Fortunately however, Android has made it so easy. When you publish your latest update on Cafe Bazaar, Cafe Bazaar will notify users who have an older version installed.

Versioning in Android is taken care of by two features, versionCode and versionName, which are included in your app’s Manifest file.

 

versionCode

Its value of this attribute is an integer and is not displayed to users. versionCode is used to indicate whether the version of application we are creating is an upgrade or not. Therefore, anytime you decide to load a new version of your app onto Cafe Bazaar, you will need to raise versionCode.

You can set this value at any integer, but you need to take care that in each version of the app, this value is greater than that which goes with the previous version. For example, if the versionCode for the previous version is 2, the next version can have any value for versionCode greater than 2, meaning you would be able to use 3, 10, 1000, or any integer larger than 2.

Note: It is recommended that the new version adds the versionCode value by no more than 1. For the above example, 3 is the better choice.

As an example, imagine that the versionCode of the application you have already published on Cafe Bazaar is 2. Users have reported problems with some part of the app. You have fixed the problem and are going to publish the improved package on Cafe Bazaar for users to download and use. What you need to is to change versionCode to 3 in the AndroidManifest.xml file before exporting the final apk.

versionName

The value for versionName is a string which is shown to users and in fact is a point of reference for that version of the app.

Imagine that your app’s versionCode was 2 and its versionName “1.02”. Now that you are going to publish version 3 of the app, if it comes with a few improvements from the older version, you would better change versionName to “1.03”. However, if the new version comes with a lot of improvements, you would better use “2.00” as versionName.

 

An example of the Manifest file

Below you see an example of the Manifest file in which android:versionCode and android:versionName are identified:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

     package="com.example.package.name"

     android:versionCode="2"

     android:versionName="1.1">

   <application android:icon="@drawable/icon" android:label="@string/app_name">

       ...

   </application>

</manifest>

 

In this example, android:versionCode shows that this is the second version of the app being published. Considering android:versionName, it can be said that the second version comes with some small changes.

The ways to increase the values for versionName and versionCode in two tools, Android Studio and Basic4android, are shown here.

Android Studio

Following the picture below, open the build.gradle file and change versionCode and versionName.

Note: To make sure that changes are applied, use the Clean Project button.

Basic4android

In Basic4android, you are able to easily increase your app’s versionCode and versionName as shown in the picture below.