Code signing
Android APKSigner

Sign APKs with Android APKSigner by using Futurex PKCS #11

3min

This section shows how to sign an APK with APKSigner and provides a demonstration.

Sign an APK with APKSigner

Find the apksigner module at /Android/sdk/build-tools/<version>/ and perform the following steps:

1

To sign an APK with Android APKSgner, run the following command:

Adjust the values for the following arguments to match your environment:

  • --ks-pass: The password set for the keystore when you created it in the previous section,
  • --ks-key-alias: The key alias you provided in the previous section, such as apksignerdemo.
  • --in: The .apk file you want to sign, including the full path to the file if necessary.
  • --out: The name of the signed .apk file, including the full path if necessary.
Shell

2

To verify the signature of the output file, run the following command:

Shell


You should see output similar to the following example:

Shell


In the preceding example, multiple signatures occurred for different Android signing versions. To only sign with one signing version type, add the following flags to your command and enable only the version you want to use to sign:

Shell


APKSigner demonstration

The following example demonstrates a signing command with APKSigner:

Shell


The following example demonstrates a verification command with APKSigner:

Shell


For more information on APKSigner and its functions, refer to the Android Developer Documentation.