I have an entry in my keystore file. I can see the contents with the command:
$ keytool -list -keystore app-signing-key.keystore
Enter keystore password:
Keystore type: jks
Keystore provider: SUN
Your keystore contains 1 entry
appsigning, Sep 8, 2021, trustedCertEntry,
Certificate fingerprint (SHA1): D:....<the sha1 here>...:D
I am trying to use this entry to create apks using the java bundle tool and the following command, but I am getting an error that the entry cannot be found.
$ java -jar $HOME/bin/bundletool-all-1.8.0.jar build-apks --bundle ./app-release.aab --output app.apks --connected-device --ks ./app-signing-key.keystore --ks-key-alias=appsigning
Enter keystore password:
[BT:1.8.0] Error: No key found with alias 'appsigning' in keystore.
com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: No key found with alias 'appsigning' in keystore.
at com.android.tools.build.bundletool.model.exceptions.InternalExceptionBuilder.build(InternalExceptionBuilder.java:57)
at com.android.tools.build.bundletool.model.SignerConfig.readSigningConfigFromLoadedKeyStore(SignerConfig.java:184)
at com.android.tools.build.bundletool.model.SignerConfig.extractFromKeystore(SignerConfig.java:140)
at com.android.tools.build.bundletool.commands.BuildApksCommand.populateSigningConfigurationFromFlags(BuildApksCommand.java:1127)
at com.android.tools.build.bundletool.commands.BuildApksCommand.fromFlags(BuildApksCommand.java:599)
at com.android.tools.build.bundletool.commands.BuildApksCommand.fromFlags(BuildApksCommand.java:565)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:77)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:49)
which is weird.
Why the bundletool does not see the entry using the alias name?
You have to provide alias for your keystore Like:
If you dont specify any
KEY_ALIAS
then it will take default alias as 'appsigning'.