Flutter无法创建keystore:keytool提示文件路径找不到求助
问题:Keytool创建Keystore失败,找不到指定路径文件
我按指引操作创建Keystore,操作流程如下,但最终出现报错,且找不到生成的keystore文件,想问下是不是创建没成功?
报错信息
keytool error: java.io.FileNotFoundException: %userprofile%\upload-keystore.jks (The system cannot find the path specified) java.io.FileNotFoundException: %userprofile%\upload-keystore.jks (The system cannot find the path specified) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(FileOutputStream.java:270) at java.io.FileOutputStream.<init>(FileOutputStream.java:213) at java.io.FileOutputStream.<init>(FileOutputStream.java:101) at sun.security.tools.keytool.Main.doCommands(Main.java:1194) at sun.security.tools.keytool.Main.run(Main.java:366) at sun.security.tools.keytool.Main.main(Main.java:359)
操作步骤
Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: What is the name of your organizational unit? [Unknown]: What is the name of your organization? [Unknown]: What is the name of your City or Locality? [Unknown]: What is the name of your State or Province? [Unknown]: What is the two-letter country code for this unit? [Unknown]: Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct? [no]: yes Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days for: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown Enter key password for <upload> (RETURN if same as keystore password):
解答
- 是的,你的Keystore没有创建成功。
- 报错核心是系统无法解析
%userprofile%环境变量,导致keytool找不到要写入的文件路径,最终生成失败。 - 修复方案:
- 直接使用绝对路径,比如把命令里的路径换成
C:\Users\你的实际用户名\upload-keystore.jks - 先通过
cd %userprofile%命令切换到用户目录,再执行keytool命令,此时只需要指定文件名upload-keystore.jks即可
- 直接使用绝对路径,比如把命令里的路径换成
内容的提问来源于stack exchange,提问作者RISKAY
相关产品推荐
相关产品推荐

