Signing apps for release

Email In PDF.

Applications need to be signed in order to be installed on phones. Even with the latest SDK, if you try to install an unsigned apk, it throws an error whereas a signed apk installs smoothly,

Creating a Private Key

For signing the apk, you need a keystorefile which will contain your key-pair. A keystore is a database of private keys and their associated X.509 certificate chains authenticating the corresponding public keys. JDK provides keytoolto accomplish this task. More info about keytoolis available here. If you already have a key, you can skip this section and go to Signing apk, if not, there are two ways to do it, using KeyTool IUI, a GUI front-end for creating private keys or through the console.

Using KeyTool IUI

Steps ::

1. If using the standalone application, edit the run_ktl.batand set HOME_JAVA to your \bin\javapath.

2. To start the application with JDK 1.6.x, use java -jar rc15ktl.jarat the console. For JDK < 1.6 use run_ktl.bat.

Using Console

We use the keytoolcommand. The entire sequence is like,

keytool -v -genkeypair -alias -keyalg RSA -validity 365 -keystore where, vis verbose mode genkeypair- generates a key pair (a public key and associated private key). alias- shortname for your key. Default value is " mykey". keyalg- specifies the algorithm to be used to generate the key pair. Default value is DSA when used with -genkeypair. validity- the number of days for which the certificate will be valid. Default is 90 days. keytoolasks for a password for keystore, same can be used as password for the key pair. Some questions like your name and organization are asked which are optional. If everything goes right you should see an output like below, Image:Sign2.png

Signing apk

You need an unsigned apk file. In Eclipse, right-click on the project, select Android Tools > Export Unsigned Application. Put the keystore(or .jks) file and apk file in the same folder for convenience.

jarsigner -verbose -keystore -signedjar where, keystore- the keystore file created earlier. If you used

KeyTool IUI, it is your .jksfile.

signedjar- the name to be used for the signed JAR file. If this option is not used, the unsigned apk file is overwritten with the signed apk file.

If everything goes right, you should see an output like below,

Image:Sign3.png

Theo gphone

Comments (0)Add Comment

Write comment

security code
Write the displayed characters


busy