Ant release

By default, the build script compiles the application .apk without signing it. The output file in your project bin/ will be <your project name>-unsigned.apk. Because the application .apk is still unsigned, you must manually sign it with your private key and then align it using zipalign.

-dname <name>

A Distinguished Name that describes who created the key. The value is used as the issuer and subject fields in the self-signed certificate.

Note that you do not need to specify this option in the command line. If not supplied, Jarsigner prompts you to enter each of the Distinguished Name fields (CN, OU, and so on).

-validity <valdays>

The validity period for the key, in days.

Note: A value of 10000 or greater is recommended.

-keypass <password>

The password for the key.

As a security precaution, do not include this option in your command line unless you are working at a secure computer. If not supplied, Keytool prompts you to enter the password. In this way, your password is not stored in your shell history.

Here's an example of a Keytool command that generates a private key:

Here's an example of a Keytool command that generates a private key:

However, the Ant build script can also perform the signing and aligning for you, if you have provided the path to your keystore and the name of your key alias in the project's build.properties file. With this information provided, the build script will prompt you for your keystore and alias password when you perform ant release, it will sign the package and then align it. The final output file inbin/ will instead be <your project name>-release.apk. With these steps automated for you, you're able to skip the manual procedures below (steps 3 and 4). To learn how to specify your keystore and alias in the build.properties file, see Developing In Other IDEs: Building in release mode.

0 0

Post a comment