Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art
Signing Your ApplicationBack to Android Cookbook Home | Up to Chapter: Packaging, deploying and selling

Author: Zigurd Mednieks ('zigurd')
In Published Edition? Yes
FormatLanguage: WikiFormat

Signing Your Application


You want to sign your application prior to uploading it to the Android Market.


An APK file is a standard Java Archive (JAR) format, so you just use the standard JDK tool jarsigner.


Having created a key, and a Map API key if needed, you are almost ready to sign your application, but first you need to create an unsigned version that you can sign with your digital certificate. To do that, in the Package Explorer window of Eclipse, right-click on your project name. You'll get a long pop-up menu; toward the bottom, click on Android Tools. You should see another menu that includes the item you want: "Export Unsigned Application Package...". This item takes you to a File Save dialog box, where you can pick the place to save the unsigned version of your apk file. It doesn't matter where you put it, just pick a place you can remember. Now that you have an unsigned version of your apk file, we can go ahead and sign it using jarsigner.

Open a terminal or command window in the directory where you stored the unsigned apk file. To sign MyApp, using the key generated earlier:

$ jarsigner -verbose -keystore myapp.keystore MyApp.apk mykey

You should now have a signed version of your application that can be loaded and run on any Android device. But before you send it in to Android Market, there's one more intervening step.... You have re-built the application, so you must test it again, on real devices. If you don't have a real device get one. If you only have one, get more, or make friends with somebody that owns a device from a different manufacturer.

See Also