我正在按照说明将 Flutter 应用程序部署到 Play 商店。 https://flutter.dev/docs/deployment/android
我已经到了标题创建 keystore
系统提示我输入密码、我的名字等,并完成该过程中的所有步骤,直到我说"is",然后我收到以下错误
[Storing ~/key.jks]
keytool error: java.io.FileNotFoundException: ~\key.jks (The system cannot find the path specified)
java.io.FileNotFoundException: ~\key.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:1144)
at sun.security.tools.keytool.Main.run(Main.java:343)
at sun.security.tools.keytool.Main.main(Main.java:336)
我不确定如何解决这个问题。
我已经尝试使用以下每个命令: "C:\Program Files\Android\Android Studio\jre\bin\keytool"-genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
这个导致了上面的错误。
我也尝试过: "C:\Program Files\Java\jre-10.0.1\bin\keytool"-genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
这会导致以下错误:
[Storing ~/key.jks]
keytool error: java.io.FileNotFoundException: ~\key.jks (The system cannot find the path specified)
java.io.FileNotFoundException: ~\key.jks (The system cannot find the path specified)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(Unknown Source)
at java.base/java.io.FileOutputStream.<init>(Unknown Source)
at java.base/java.io.FileOutputStream.<init>(Unknown Source)
at java.base/sun.security.tools.keytool.Main.doCommands(Unknown Source)
at java.base/sun.security.tools.keytool.Main.run(Unknown Source)
at java.base/sun.security.tools.keytool.Main.main(Unknown Source)
我还尝试将这些目录中的每一个添加到路径中,而不是发出文档中列出的命令: keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
但这给了我这个错误: 'keytool' 未被识别为内部或外部命令,
有人遇到过这个吗?
最佳答案
在 Linux 和 MacOS 中,'~' 是“我的主目录”的快捷方式,因此 ~/key.jks
扩展为,例如,/home/fluttercoder/key。 jks
。显然,这个文件夹在 Windows 上不存在。
在Windows上选择不同的文件夹,例如c:\Users\fluttercoder\keys\
,这样文件就变成了c:\Users\fluttercoder\keys\key.jks
。 (小心任何包含空格的 Windows 文件夹。最好避免使用它们;否则将它们用双引号引起来。)
关于android - 问题生成 ~\key.jks 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55494785/