Chris Hall bio photo

Chris Hall

Adjusting technology to make it fit my requirements...

Windows, Linux, Virtualisation, Unified Computing & Cloud Offerings Design Engineer.

PolarCloudsUK Chris Google+ LinkedIn Github
Signing Android apps: Easy!
Bit of a memory jogger for me this post, but possibly handy for others too.

Yes I realise that this information is almost everywhere on the net, but I can never seem to find it when I need it or when I do, I seem to find a Windows method when running Linux or find a Linux method when running Windows...

Firstly: why sign Android files?  Simple.  All Android apps must be signed.  Android will not install apk apps (or zip files in recovery mode) without them being signed. 

OK, so if you want to install it, you have to sign it.  But digitally signing files is a bit of a faff isn't it?  No not really.

With a little help for the Android SDK (Software Development Kit) and the Android coder Amon_RA, you can be signing Android files quickly and easily.

Word of warning: This method is not appropriate for signing apps for release on the Android Market as it uses test signatures.  See this Android Developers document for details on how to sign apps destined for the Android Market.  For all other uses outside of the Android Market, this method works just fine.

On with the method.  The beauty of this is that:

  1. It can be used on both Linux and Windows
  2. It's so easy, even I can follow it!
OK, here's what you need:

Install Java Runtime Environment and extract the Android SDK to, say, C:\AndroidSDK. Remember to extract the zip maintaining folder structure.

Create a folder under C:\AndroidSDK called sign, and download testsign.jar to C:\AndroidSDK\sign

Copy the file to be signed to C:\AndroidSDK\sign folder.  Drop to a command prompt and run the following command.  (In the example, I'm using Windows and my file is called "app.apk"):

java -classpath C:\AndroidSDK\sign\testsign.jar testsign C:\AndroidSDK\sign\app.apk C:\AndroidSDK\sign\app-signed.apk
Job done. 

The C:\AndroidSDK\sign folder should now contain an additional file called 'app-signed.apk'.  This is the signed file that can now be installed and tested on your Android device or in the Android Emulator.

I said it was easy ;o)

- Chris