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:
- It can be used on both Linux and Windows
- It's so easy, even I can follow it!
- Java Runtime Environment - Either OpenJDK or
Sun(Will always be Sun Java in my mind!) Oracle Java
- Google Android SDK
- Amon_RA's testsign.jar
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
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)