androidbashapksigner

Trying to understand apksigner through command android


I am trying to generate an release apk through command. I have this below command which will sign the release apk. But I am not able to understand the commands in that. Can someone please elaborate it. Specially /.keystore/keystore.jks and file:/.keystore/ks-pass:

$APKSIGNER sign --ks /.keystore/keystore.jks --ks-pass file:/.keystore/ks-pass $APK_PATH

Solution

  • The value passed in the --ks flag is the path to a keystore. A keystore contains the private key used to cryptographically sign the APK.

    A keystore is guarded by a password, which can be passed to the apksigner command through the --ks-pass flag. The password can either be passed in clear if the value is prefixed with "pass:" (e.g. "pass:mypassword1234") or through the path to a file which contains the password if the value is prefixed with "file:", like in your example.

    Hope that helps.