Before publishing your Android app, you need to sign your APK file, and then you need a private key to do it.

Generate Private Key

Runs the following line in console, and it will ask for your organization information and password.

# to generate a 2048 bits RSA key, with about validity of 986 years
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 360000

Also see

  1. Signing Your Applications -


Under construction. Related to ProGuard.

Build signed and aligned

You can build an APK file which is signed and aligned, which can be released to end users, by command line by following steps:

  1. Creates a file name "" with the following content and put it into your project folder:
  2. Opens console, goes to your project folder and runs:
    ant clean release
  3. Inputs the passwords for your Keystore file and the alias.

Caution: Due to the way Ant handles input, the password that you enter during the build process will be visible.

See also


  1. Android签名总结
Last modified 4 years ago Last modified on Sep 29, 2014, 1:25:25 PM