无效的密钥库格式 - Flutter

Invalid Keystore Format - Flutter

我按照 flutter 文档使用以下命令生成了一个密钥库:

keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload

不幸的是,我相信我的 Flutter 使用不同的 Java 位置来验证密钥,我收到以下错误:

* What went wrong:
Execution failed for task ':app:packageRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.ide.common.signing.KeytoolException: Failed to read key upload from store "/home/<username>/Documents/github/keystores/upload-keystore.jks": Invalid keystore format

flutter doctor -v returns以下:

[✓] Flutter (Channel stable, 2.8.1, on Ubuntu 20.04.3 LTS 5.4.0-91-generic, locale
    en_US.UTF-8)
    • Flutter version 2.8.1 at /home/<username>/Documents/github/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (3 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /home/<username>/Android/Sdk
    • Platform android-32, build-tools 32.0.0
    • ANDROID_HOME = /home/<username>/Android/Sdk
    • ANDROID_SDK_ROOT = /home/<username>/Android/Sdk/
    • Java binary at: /home/<username>/Documents/github/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /snap/android-studio/115/android-studio
    • Flutter plugin version 63.2.1
    • Dart plugin version 203.8452
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] Android Studio
    • Android Studio at /home/<username>/Documents/github/android-studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /home/<username>/Documents/github/android-studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.63.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.32.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.93

一个which keytool returns:

/usr/bin/keytool

我相信我可能必须更改 Flutter 使用的 Java 路径,但不知道如何更改它,如果它是我需要做的甚至远程。

最终成为密钥工具生成问题。正如预期的那样,我的应用程序密钥是使用我机器上安装的不同密钥工具生成的。我不得不再次使用正确的密钥工具生成密钥并请求 Google 更改它。