Advertisement
Tech

How to Version your Android Applications In The Google Android Programming Environment

Versioning is a very important aspect of software development. This tutorial will show you how to specify the application version in your Android application.

By hardiks
Desk Tech
Reading time 2 min read
Word count 336
Google android Mobile Guides
How to Version your Android Applications In The Google Android Programming Environment
Advertisement
Quick Take

Versioning is a very important aspect of software development. This tutorial will show you how to specify the application version in your Android application.

On this page

What is Versioning?

Versioning is a very important method used to control and specify changes in any application and the Android SDK provides you with a very easy way to specify versions in your applications. Versioning is very useful if you intend to upgrade or maintain your applications and it is also used in the Android Market when you publish your application. It is also used in the Android Market to automatically offer application upgrades. Another use of versioning is to check for compatibility and dependency issues between applications.

Advertisement

Android borrows heavily from the Java style of programming, which is evident from the similarity between the two. Android provides a versioning mechanism very similar to JAR packages in Java. To specify versions and other application specific details in Android APK application packages, you need to edit the AndroidManifest.xml file which can be found in the root directory of the application. This is analogous to the Manifest.mf file found in JAR packages in Java.

AndroidManifest.xml

Advertisement

The AndroidManifest.mf is an XML file used to store the information about any application. While it stores many details, there are two main attributes which are used to specify the version details. It is located in the root directory of your application’s APK file.

They are

Advertisement

1. android:versionCode

This attribute is an integer value which is used to specify the version of the application relative to other versions. You can increment this in each new version to show a upgrading relationship between them. It isn’t accessible by the users and is only used by the system.

Advertisement

2. android:versionName

This attribute is a string value which represents the exact version number of the application. This value is used to display version information to the users. It can be of the format ..

Advertisement

Both these attributes are defined in the manifest element in AndroidManifest.xml.

Here’s an example of the AndroidManifest.xml file:

Advertisement

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

package=“com.brighthub.package.name”

Advertisement

android:versionCode=“5"android:versionName=“1.2.1”>

Advertisement

…….

Advertisement

The attributes are highlighted in bold. In this example, the versionCode is 5 and the versionName is 1.2.1.

Advertisement
Keep Exploring

More from Tech

Filed under
Google android Mobile
More topics
Guides
Advertisement