简体   繁体   中英

Why Android Developer Bundle Tool Does not Recognize the Key In my Keystore?

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:

keytool -list -keystore app-signing-key.keystore -alias KEY_ALIAS_HERE

If you dont specify any KEY_ALIAS then it will take default alias as 'appsigning'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM