当我运行keytoll获取keyrelease时显示此错误

时间:2019-03-07 06:03:13

标签: android react-native keytool

在C:\ Program Files \ Java \ jdk1.8.0_191 \ bin中运行1-powersell

  

keytool.exe存在

2次运行

  

keytool -genkey -v -keystore版本-key.keystore -alias key-alias   -keyalg RSA -keysize 2048-有效性10000

但显示此错误:

keytool : The term 'keytool' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ keytool -genkey -v -keystore d:\release-key.keystore -alias key-alias ...
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (keytool:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

建议[3,常规]:找不到命令键盘工具,但是它存在于当前位置。 Windows PowerShell默认情况下不会从当前位置加载命令。如果您信任此命令,请键入:“。\ keytool”。有关更多详细信息,请参见“获得关于about_Command_Precedence的帮助”。

1 个答案:

答案 0 :(得分:1)

可以有两种解决方法,

  1. 转到 Java \ jdk1.8.0_191 \ bin 目录,然后在其中打开cmd或powershell并运行命令
  2. 您需要在系统环境的路径变量中设置 Java \ jdk1.8.0_191 \ bin 路径

    编辑

实际上keytool位于jre文件夹中,而不位于jdk中。

所以检查一下

  1. 转到 Java \ jre1.8.0_191 \ bin 目录,然后在其中打开cmd或powershell并运行命令
    1. 您需要在系统环境的路径变量中设置 Java \ jre1.8.0_191 \ bin 路径

并确保在使用第一种解决方案时,使用.\keytool.exe代替keytool