Sign an APK
Find the apksigner module at/Android/sdk/build-tools/<version>/ and perform the following steps to sign an APK with APKSigner:
If using Java JDK version newer than 17, run the following command:and replace
Shell
javaOpts="" with the following line:None
To sign an APK with Android APKSigner, run the following command:When prompted for the
Adjust the values for the following arguments to match your environment:
- —ks-key-alias: The key alias you provided in the previous section, such as Android APK Signer:apksignerdemo:C. Note: If there are spaces in the key alias, make sure to wrap the entire alias in double-quotes.
- —in: The
.apkfile you want to sign, including the full path to the file if necessary. - —out: The name of the signed
.apkfile, including the full path if necessary.
Shell
keystore password for signer #1, enter the identity password configured inside the <CRYPTO-OPR-PASS> tag in the fxpkcs11.cfg file.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
Shell

