keytool 错误:java.lang.Exception:必须指定 -keyalg 选项

问题描述

我在 CMD Administrator 中生成了我的 android 应用程序证书,这是我输入的命令。

keytool -genkey -v -keystore c:\my-release-key.keystore -alias omar

如图所示

command prompt screenshot of error

密码 = " 123456 "

问题是什么以及如何解决

解决方法

就像屏幕截图中的错误消息所说的那样。

The -keyalg option must be specified.

以下对我有用:

$ keytool -genkey -keyalg RSA -v -keystore foo.jks -alias smith
Enter keystore password:  
Re-enter new password: 
What is your first and last name?
  [Unknown]:  steve
What is the name of your organizational unit?
  [Unknown]:  here
What is the name of your organization?
  [Unknown]:  there
What is the name of your City or Locality?
  [Unknown]:  here
What is the name of your State or Province?
  [Unknown]:  there
What is the two-letter country code for this unit?
  [Unknown]:  AU
Is CN=steve,OU=here,O=there,L=here,ST=there,C=AU correct?
  [no]:  yes

Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 90 days
    for: CN=steve,C=AU
[Storing foo.jks]

有关详细信息,请参阅 Oracle KeyTool Documentation