【发布时间】:2022-01-12 22:46:20
【问题描述】:
我已经阅读了几个对此错误的回复,但我仍然无法确切地知道如何修复它。我已将问题缩小到不同版本的 Java,但作为一个对 Android Studio 相对较新的人(以及一般的编码),我似乎无法弄清楚如何解决这个问题。我的应用已经发布,所以我需要弄清楚如何使用我当前的密钥存储文件而不是生成新的。
我需要帮助的是弄清楚如何指定 Android Studio 中使用的 Java JDK 版本。看起来密钥库文件是使用 Java 17 生成的,但构建使用的是 Java 11,它无法读取密钥库文件。有人可以帮我解决这个问题(Mac OS 11.6.1,Android Studio 2020.3.1 Patch 4)。这是我下面的内容。
我还应该指出,由于某种原因,我无法像其他人那样根据自己的偏好设置 JDK 版本。这个选项对我来说不存在。
我使用命令生成了密钥库文件
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
运行java -version 给出:
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)
Flutter doctor -v
```[✓] Flutter (Channel stable, 2.8.1, on macOS 11.6.1 20G224 darwin-x64, locale en-US)
• Flutter version 2.8.1 at /Users/dennisashford/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (4 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 31.0.0)
• Android SDK at /Users/dennisashford/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] VS Code (version 1.59.1)
• VS Code at /Users/dennisashford/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0
[✓] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• iPhone 12 (mobile) • CCFE8FB8-8AEB-4D19-9A7B-B5AEE7F5F411 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.71```
【问题讨论】:
-
你解决了这个问题吗?
-
@Alexa289 不幸的是,没有。我不得不使用 Java 11 可读的旧格式生成密钥库。这很令人沮丧,但它暂时有效。
标签: java android flutter android-studio keystore