简体   繁体   English

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

[英]How do I generate a .jpk signature file for keystore signing for Android Studio in Windows Command Line?

I am trying to generate a keystore path in Android Studio, how do I find the java.io file?我正在尝试在 Android Studio 中生成密钥库路径,如何找到 java.io 文件? I read and implemented a solution: How can I create a keystore?我阅读并实施了一个解决方案: 如何创建密钥库? in the Windows Command Line.在 Windows 命令行中。 I then receive an error after executing the solution.然后我在执行解决方案后收到一个错误。 I am running the OS as the administrator.我以管理员身份运行操作系统。

I have learned that the java.io is generic.我了解到 java.io 是通用的。 I searched my PC for the java.io file and did not find it.我在我的电脑上搜索了 java.io 文件,但没有找到。 I have learned that many of these issues can be avoided by switching to a Linux OS.我了解到,通过切换到 Linux 操作系统,可以避免许多这些问题。

The expected result was a.jpk keystore signature file.预期的结果是一个.jpk 密钥库签名文件。 The actual result is an java.io.FileNotFoundException: my-release-key.keystore (Access is denied) error.实际结果是 java.io.FileNotFoundException: my-release-key.keystore (Access is denied) 错误。

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>

To generate the keystore file from the command line you must run the command line as an administrator.要从命令行生成密钥库文件,您必须以管理员身份运行命令行。 This is achieved by typing cmd in the search bar, then right clicking on the Command Prompt App and then selecting Run as administrator.这是通过在搜索栏中键入 cmd 来实现的,然后右键单击命令提示符应用程序,然后选择以管理员身份运行。 https://www.howtogeek.com/howto/windows-vista/enable-the-hidden-administrator-account-on-windows-vista/ Follow the directions outlined in How can I create a keystore? https://www.howtogeek.com/howto/windows-vista/enable-the-hidden-administrator-account-on-windows-vista/按照如何创建密钥库?

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 代码签名,我需要生成一个密钥库吗? - Code signing, do I need to generate a keystore? 如何在命令行上指定密钥库类型? - How do I specify the keystore type on the command line? 如何使用 Android 上的密钥库创建证书签名请求? - How do you create a Certificate Signing Request using the KeyStore on Android? 如何在 android studio 上为 Android Apk 文件生成 SHA512 校验和 - How do I generate SHA512 checksum for an Android Apk file on android studio 密钥库和Android的签名问题 - Signing problems with keystore and Android 如何从命令行生成Java文件的串行版本UID? - How do I generate the serial version UID of a Java file from command line? Android密钥库签名问题 - Android keystore signature problem 在Windows中使用“打开方式”时,如何将文件路径传递给命令行争论? - How do I pass file path to command line arguements when using “open with” in Windows? 我有一个密钥库文件,如何在 Android 应用程序中为 sslContext 提供密钥管理器? - I have a keystore file, how do I provide keyManagers to sslContext in Android app? 如何从命令行在 Windows 上运行 .class 文件? - How do I run .class files on windows from command line?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM