Friday, November 4, 2011

Do Before Publish Your Android Application

Preparing and packaging an application for publication is called the release process. The release process is an exciting time: The application is stable and working as expected, all those troublesome bugs have been resolved (within reason, at least), and you feel that you’re ready to put your app in front of users.
The final build you perform - the build you expect to deliver to users - is called the release candidate build. The release candidate build should be rigorously tested and verified before it reaches users’ hands. If the release candidate build passes every test, it becomes the release build - the official build for publication.

Before Packaging and Signing an Application:

  1. Sufficiently test the application, including testing on target handsets.
  2. Fix and verify all defects and bugs in the application.
  3. Turn off all debugging diagnostics for release, including any extraneous logging that could affect application performance. (And disable the debuggable option in manifest file)
  4. Verify that the application icon (various sizes of PNG) is set appropriately. This icon is seen by users and is often used by marketplaces to display the application.
  5. Verify that the application label is set appropriately. This represents the application name as users see it.
  6. Verify that the application version name is set appropriately. The version name is a friendly version label that developers (and marketplaces) use. (NOTE: The Android SDK allows the android:versionName attribute to reference a string resource. The Android Market does not. You will encounter an error during the upload process when your package is validated. The package will not be accepted.)
  7. Verify that the application version code is set appropriately. The version code is a number that the Android platform uses to manage application upgrades. Consider incrementing the version code for the release candidate in order to differentiate it from the prerelease version of the application.
  8. Confirm that the application uses-sdk setting is set correctly. You can set the minimum, target, and maximum Android SDK versions supported with this build. These numbers are saved as the API level of each Android SDK. For example, Android 2.1 is API level 7.
  9. Confirm that all application permissions are appropriate. Request only the permissions the application needs with uses-permission, and make sure to request permissions the application uses, regardless of handset behavior without them.

Packaging and Signing an Application:

Now u need to package the application for publication. This process involves generating the Android package file (the .apk file) and digitally signing it.

Android application packages must be digitally signed for the Android package manager to install them. Throughout the development process, Eclipse has used a debug key to manage this process. However, for release, you need to use a real digital signature—one that is unique to you and your company. To do this, you must generate a private key.

NOTE: You don’t need to use a certificate authority, such as VeriSign, Equifax, or any of the other companies that certify that you are who you say you are before providing a certificate. Self-signing is standard for Android applications, which simply means that you aren’t proving who you are, but the next time you publish something, if the keys match, then users (and Android) know it’s been signed by the same person or entity. So don’t share your private key!

Application updates must be signed with the same private key. For security reasons, the Android package manager does not install the update over the existing application if the key is different. This means you need to keep the key corresponding with the application in a secure, easy-to-find location for future use. 

You are now ready to export and sign your Android package file. To do this using the wizard provided as part of the Eclipse ADT plug-in, perform the following steps:
  1. In Eclipse, right-click the appropriate application project and choose the Export option.
  2. Under the Export menu, expand the Android section and choose Export Android Application.
  3. Click the Next button.
  4. Select the project to export. The one you right-clicked is the default, but youcan use the Browse button to change to other open Eclipse projects as well.
  5. Click the Next button.
  6. On the keystore selection screen, choose the Create New Keystore option and enter a file location (where you want to store the key) as well as a password for managing the keystore. (If you already have a keystore, choose browse to pick your keystore file and then enter the correct password.)
  7. Click the Next button.
  8. On the Key Creation screen, enter the details of the key, including information about your organization. See the note on key validity below. If you need help with other particular fields, see the Android developer website documentation on application signing at Your details might look something like what is shown following:
    NOTE: The Android Market rejects any application with a key that is not valid until at least October 22, 2033, so choose a key validity of at least 25 years to cover this requirement.
  9. Click the Next button.
  10. On the Enter Destination and Key/certificate Checks screen, enter a file destination for the application package file.
  11. Click the Finish button.
  12. You have now created a fully signed and certified application package file :)

Testing the Signed Application Package:

Before installing the release version of your application on the emulator or handset, you must uninstall the debug version completely, as it uses a different signature and the new one can’t be directly installed over it. Uninstall apps from the Home screen by clicking Menu => Settings => Application => Manage Applications, choosing the application from the list, clicking the Uninstall button, and verifying that you want to uninstall the application.

The simplest way to manually install (or uninstall) an application package (.apk) file on a handset or the emulator is to use the adb command-line tool. The following is the command for installing a package using adb:

> adb install <path_to_apk>

If there is only one device or emulator, this command works. However, if you have multiple devices and emulators floating around, you need to direct the installation command to a specific one. You can use the devices command of the adb utility to query for devices connected to your computer:

> adb devices
List of devices attached
emulator-5554 device
HT9CSP801234 device

> adb -s emulator-5554 install BeenThereDoneThat.apk

For more information about the adb command-line tool, see the website


  1. Thanks for provide the information related to Android application.This is one of the suitable post.I like your blog collection.
    Android app developers

  2. Not at all.
    I'm glad to read comments like this :)

    1. I concur with your conclusions and will eagerly look forward to your future updates. The usefulness and significance is overwhelming and has been invaluable to me.

      Android developer