Monday, May 2, 2011

Android: How to sign your application

If you want to install and run your Android app on your phone or if you want to market it, you need to sign your app. Signing apps helps prevent the user from fraudulent apps. Signing your app is simple and can be done with standard tools i.e keytool and jarsigner that come with a Java JDK. To sign your app first generate a valid key. You can use the following command for that purpose:

This will generate a file named my-android-key.keystore in the current directory. This file contains the key that you can use to sign your apps. If you want you can move this key to more appropriate location.

Now you need to sign your app using this key. This is done using the jarsigner utility from JDK. Given below is the command line you can use to sign your app i.e the .apk file with the above generated key: