简体   繁体   中英

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? I read and implemented a solution: How can I create a keystore? in the Windows Command Line. 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. I searched my PC for the java.io file and did not find it. I have learned that many of these issues can be avoided by switching to a Linux OS.

The expected result was a.jpk keystore signature file. The actual result is an java.io.FileNotFoundException: my-release-key.keystore (Access is denied) error.

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. 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?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM