正在尝试为android构建版本。我在vscode终端中运行了keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
,但是我得到了这个错误
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 ~/key.jks -keyalg RSA -keysize 2048 -val ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (keytool:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我运行flutter doctor -v,并使用路径获取此Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
,并将java替换为keytool(如文档中所示),但仍收到错误。我该怎么做?
发布于 2019-11-19 22:52:17
创建密钥库如果您已有密钥库,请跳到下一步。如果没有,请在命令行中运行以下命令来创建一个:
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
注意:将此文件保持为私有;不要将其签入公共源代码管理。
注意: keytool可能不在您的路径中。它是Java JDK的一部分,Java JDK作为Android Studio的一部分安装。对于具体的路径,运行flutter doctor -v并查看打印在‘java binary at:’之后的路径,然后使用该完全限定的路径替换java为keytool。
storePassword=password from previous step
keyPassword=password from previous step
keyAlias=key
storeFile=location of the key store file, e.g. /Users/user name/key.jks
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
查看本教程的描述:https://www.youtube.com/watch?v=nGvPNG-f1-o
或者使用工具生成密钥
应用签名工具下载地址:https://shatter-box.com/knowledgebase/android-apk-signing-tool-apk-signer/
转到Java二进制文件目录: C:\Program Files\Android\Android Studio\jre\bin\java
然后键入cmd并输入enter image description here
按照视频教程生成密钥,将密钥放在您想要的任何位置,然后按照下一个教程在第一个教程中使用app包装密钥。
发布于 2018-07-26 01:22:13
尝试从普通的Windows命令提示符运行它
D:\temp>"c:\Program Files\Android\Android Studio\jre\bin\keytool.exe" -help
Key and Certificate Management Tool
Commands:
-certreq Generates a certificate request
-changealias Changes an entry's alias
-delete Deletes an entry
-exportcert Exports certificate
...
另外,在Windows上,你不能使用~/
。将其更改为Windows style path,如C:\Users\Norbert\keys
,或您想要保存密钥库的任何位置。
发布于 2020-08-24 10:09:51
中运行以下命令
keytool -list -keystore %USERPROFILE%\.android\debug.keystore
这是我们可以在FireBase中使用的调试证书。
https://stackoverflow.com/questions/51521738
复制相似问题