How to create a private key for signing Android apps

To create a private key to sign your Android apps with, you need to run the keytool command (installed when you install a Java development kit) as follows.

keytool -genkey -v -keystore myandroid.keystore -alias myandroidkey -keyalg RSA -keysize 2048 -validity 10000 -dname "O=Acme Ltd"

Replace Acme Ltd with your company name.

When the tool runs it will prompt you for a password and then generate a file called myandroid.keystore. You will need this file, your password and the key’s alias (myandroidkey in this example) to sign your app.

To see the details of your key use the following command:

keytool -list -v -keystore myandroid.keystore

For more information see the Link to Signing Your Application page page in the Android developer’s documentation.