首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Windows命令行中生成用于Android Studio密钥库签名的.jpk签名文件?

如何在Windows命令行中生成用于Android Studio密钥库签名的.jpk签名文件?
EN

Stack Overflow用户
提问于 2019-11-10 00:53:39
回答 1查看 399关注 0票数 1

我正尝试在Android Studio中生成密钥库路径,如何找到java.io文件?我在Windows命令行中阅读并实现了一个解决方案:How can I create a keystore?。然后,我在执行解决方案后收到一个错误。我以管理员身份运行操作系统。

我了解到java.io是通用的。我在PC上搜索java.io文件,但没有找到。我了解到,这些问题中的许多都可以通过切换到Linux操作系统来避免。

预期的结果是.jpk密钥库签名文件。实际的结果是一个java.io.FileNotFoundException: my-release-key.keystore (访问被拒绝)错误。

代码语言:javascript
复制
Microsoft Windows [Version 10.0.18362.418]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\ronal>cd/Program Files/Java/jdk-13.0.1/bin

C:\Program Files\Java\jdk-13.0.1\bin>keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  Ronald Sheaks
What is the name of your organizational unit?
  [Unknown]:  Imperative GIS Consulting
What is the name of your organization?
  [Unknown]:  Imperative GIS Consulting
What is the name of your City or Locality?
  [Unknown]:  Kirtland
What is the name of your State or Province?
  [Unknown]:  Ohio
What is the two-letter country code for this unit?
  [Unknown]:  US
Is CN=Ronald Sheaks, OU=Imperative GIS Consulting, O=Imperative GIS Consulting, L=Kirtland, ST=Ohio, C=US correct?
  [no]:  Yes

Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
        for: CN=Ronald Sheaks, OU=Imperative GIS Consulting, O=Imperative GIS Consulting, L=Kirtland, ST=Ohio, C=US
[Storing my-release-key.keystore]
keytool error: java.io.FileNotFoundException: my-release-key.keystore (Access is denied)
java.io.FileNotFoundException: my-release-key.keystore (Access is denied)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:292)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:124)
        at java.base/sun.security.tools.keytool.Main.doCommands(Main.java:1346)
        at java.base/sun.security.tools.keytool.Main.run(Main.java:416)
        at java.base/sun.security.tools.keytool.Main.main(Main.java:409)

C:\Program Files\Java\jdk-13.0.1\bin>
EN

回答 1

Stack Overflow用户

发布于 2019-11-11 07:56:58

要从命令行生成密钥库文件,必须以管理员身份运行命令行。这是通过在搜索栏中键入cmd,然后右键单击命令提示符应用程序,然后选择以管理员身份运行来实现的。https://www.howtogeek.com/howto/windows-vista/enable-the-hidden-administrator-account-on-windows-vista/按照How can I create a keystore?中概述的说明进行操作

代码语言:javascript
复制
Microsoft Windows [Version 10.0.18362.418]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
'keytool' is not recognized as an internal or external command,
operable program or batch file.

C:\WINDOWS\system32>
C:\WINDOWS\system32>cd/Program Files/Java/jdk-13.0.1/bin

C:\Program Files\Java\jdk-13.0.1\bin>keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  Ronald Sheaks
What is the name of your organizational unit?
  [Unknown]:  Imperative GIS Consulting
What is the name of your organization?
  [Unknown]:  Imperative GIS Consulting
What is the name of your City or Locality?
  [Unknown]:  Kirtland
What is the name of your State or Province?
  [Unknown]:  Ohio
What is the two-letter country code for this unit?
  [Unknown]:  US
Is CN=Ronald Sheaks, OU=Imperative GIS Consulting, O=Imperative GIS Consulting, L=Kirtland, ST=Ohio, C=US correct?
  [no]:  Yes

Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
        for: CN=Ronald Sheaks, OU=Imperative GIS Consulting, O=Imperative GIS Consulting, L=Kirtland, ST=Ohio, C=US
[Storing my-release-key.keystore]

C:\Program Files\Java\jdk-13.0.1\bin>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58781484

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档