Android Apps, Versioning, and Publishing

Assuming you’re using Eclipse and have already setup the android-sdk and have a working application ready to move from being developed and running in the emulator/your device, the next step is taking care of licensing (if you haven’t done so already) and then signing the application.

Licensing

Licensing is important if you want to make it more difficult for your application to be available on a device without users downloading it via the android market place. If you have an app you intend people to pay for then its a pretty good idea to implement the license verification library (LVL) in your application. More details on how to do this can be found at the the android developer docs on licensing page. It also goes into greater detail about how the licensing works, and how to implement it in your application. If you’ve have a demo app, don’t care about it making you any money via paid downloads then you can probably skip this step (however, if anyone has a reason why this step should always be included feel free to leave a comment).

Versioning

In your android manifest file, make sure you have the following two attributes:
android:versionCode
android:versionName

The market uses “versionCode” to track the versions of your application floating around. If you fix a few bugs, make a few enhancements, or just upload a new version with nothing different, users who have already installed your app won’t be notified that an update is available. With each update to your application published, increment the “versionCode”.

“versionName” is what the user sees for the version of your application. Not as important as the previous attribute.

Here’s an example of these attributes in action:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="net.callahat.myApp"
      android:versionCode="2"
      android:versionName="1.0.3">

For more information on versioning, see the the android developer documents here.

Signing

Finally its time to create a signed package. If you’re using Eclipse, then this is pretty easy (hardest part is remembering those passwords).

  1. Right click on your project in Eclipse
  2. Mouseover “Android Tools”
  3. Click “Export Signed Application Package” (Your package should be selected as the package to export)
  4. Click next
  5. If you haven’t exported a package before, select “Create new keystore”. Chose a location you will remember, as this will store your keys for all your applications. Guard it well, and make sure its backed up. Losing it will complicate things, especially if you have updates to applications you need to make later. Also don’t forget the password you give it.
  6. If you haven’t created a key for this application before, select “Create new key”
  7. Give it a logical alias, such as the name of your application. Each application you sign should have a different key, which will be identifiable to you by the alias. Make sure you don’t forget this password either. When you sign a new version of your application you will use this same key.
  8. Make sure you give the validity a high number of years (at least 25 years or more is recommended)
  9. Fill out the details identifying you as the publisher.
  10. Specify where you want the package put and what you want it called, then upload that package to the marketplace (after testing it on your device to verify its working first.)

If you’ve already created a keystore, make sure you use the same key that you first signed the package with.

For more information on signing, see the androd dev signing documents.