android - 为什么 Android Developer Bundle Tool 无法识别我的密钥库中的密钥?
问题描述
我的密钥库文件中有一个条目。我可以使用以下命令查看内容:
$ 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
我正在尝试使用此条目来使用 java bundle 工具和以下命令创建 apk,但我收到一个错误,即找不到该条目。
$ 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)
这很奇怪。
为什么 bundletool 看不到使用别名的条目?
解决方案
您必须为您的密钥库提供别名,例如:
keytool -list -keystore app-signing-key.keystore -alias KEY_ALIAS_HERE
如果您未指定任何KEY_ALIAS
内容,则默认别名为“appsigning”。
推荐阅读
- java - CloudSim 迁移在哪里:分配和选择策略示例
- html - Overflow: auto, position: relative and padding-left in Chrome 78 causes html overflow
- git - Git repo must match directory structure on disk? What about project where code lives in diff directories?
- python - 如何计算访问函数的频率?
- vue.js - THREEJS - 加载图像后网格消失
- flutter - 我可以使用 setState 更改小部件的主体吗?
- javascript - 从函数返回未定义
- c++ - 为什么优化大型 std::vectors 数组会导致 SegFault?
- python - 如何存储这些值?
- aws-lambda - 如何在 AWS 中使用 Lambda 和 S3 事件