Getting Started in Android Development Part 46 - Preparing your App for Publication

North Border Software




Home Tutorials Hints & Tips About
Share on Facebook Share on Twitter

Getting Started in Android Development

Part 46 - Preparing your App for Publication

At some point you will either want to publish your app or test it on a real device. There are activities you need to undertake to prepare your app for publication.

Ultimately, you want to produce a signed Android Application Package (or APK file). In the process of generating the APK you need to do the following:

Application Versions

Versioning is a critical component of your application upgrade and maintenance strategy. Users need to have knowledge of the version number of the application. The android system will not allow an application with a lower version number to be installed over the same application with a higher version number. Market places also display the version umber to users.

Android application versioning comprises two elements. The most significant is the version number and this has to be an integer value. In Android terms, the version number is referred to as the version code. The second element is the version name. This is a string value that is defined and controlled by the author. It has no real meaning, but provides a user friendly way of representing the app version.

Prior to Android Studio, the version information was controlled manually in the Android Manifest. This method is still valid if you want to control things this way. An example of how it is controlled is shown below:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.example.package.name"
   android:versionCode="2"
   android:versionName="1.0.1">

Within Android Studio the application version is controlled by Gradle. There are two ways to adjust the application version.

By selecting build.gradle (Module: app), the Gradle build information is shown in text format. In the screenshot below you can see the app versionCode and versionName. You can simply edit these values.

Setting the Android App version using Gradle in Android Studio

The second way is to choose:

File -> Project Structure -> Choose tab 'Flavors'

This opens the window shown below, where the same information can be edited.

Setting the Android App Version in Android Studio

Signing your app

Android requires that all apps be digitally signed with a certificate before they can be installed. The Android system uses this certificate to identify the author of an app. The certificate does not need to be signed by a certificate authority and Android apps often use self-signed certificates. The app developer holds the certificate's private key.

To sign your app first select:

Build -> Generate Signed APK…

Android Studio, Build, Generate Signed APK

You will be presented with the first part of a wizard. You will need to specify the path and file name of a keystore. In the screenshot below the keystore is called keystore.jks.

Android APK Signing Wizard

Enter passwords and an alias you can remember. On clicking next, you may be asked for a keystore master password if the keystore already exists. You will then be presented with another dialog box where you specify the path of the application APK file.

 Android App APK Signing Wizard

You can also specify if it is a debug or release build. Click finish and the APK file will be generated. One the process is complete you will be prompted to show the file in explorer if are using Windows. You will then be ready to publish the app simply by uploading the resultant APK file to the market.

Location of Android APK file in Android Studio


Download Download tutorial set 3


© 2015 North Border Software All rights reserved
Privacy and Cookies Terms of Use Disclaimer Copyright
North Border Software Logo

Android Apps and Training