Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access denied when creating keystore for Android app

I am trying to sign my Android app so I can release it in Market. When I generate the keystore, I get an access denied error. How do I fix this?

android keystore selection

This is what I've been trying to do:

  1. Right click project in Eclipse Helios.
  2. Android Tools > Export Signed Application Package.
  3. Click next.
  4. I check "Create new keystore" and realize it does nothing to help me. It still asks for the location of keystore. So I decide to do it the hard way.
  5. Turned off read-only access on C:\Program Files\Java\jdk1.6.0_25\bin and granted the CREATOR OWNER group full control of the folder.
  6. Open command line on Windows 7 64-bit.
  7. Traverse to C:\Program Files\Java\jdk1.6.0_25\bin.
  8. Run keytool.
  9. Got an access denied error.

.

C:\Program Files\Java\jdk1.6.0_25\bin>keytool -genkey -v -alias company -keyalg R SA -keysize 2048 -validity 10000 -keystore company.keystore Enter keystore password: Re-enter new password: What is your first and last name?   [Unknown]:  John Smith What is the name of your organizational unit?   [Unknown]:  Android What is the name of your organization?   [Unknown]:  Company What is the name of your City or Locality?   [Unknown]:  Albany What is the name of your State or Province?   [Unknown]:  NY What is the two-letter country code for this unit?   [Unknown]:  US Is CN=John Smith, OU=Android, O=Company, L=Albany, ST=NY, C=US correct?   [no]:  yes  Generating 2,048 bit RSA key pair and self-signed certificate (SHA1withRSA) with  a validity of 10,000 days         for: CN=John Smith, OU=Android, O=Company, L=Albany, ST=NY, C=US Enter key password for <veetle>         (RETURN if same as keystore password): Re-enter new password: [Storing company.keystore] keytool error: java.io.FileNotFoundException: veetle.keystore (Access is denied)  java.io.FileNotFoundException: veetle.keystore (Access is denied)         at java.io.FileOutputStream.open(Native Method)         at java.io.FileOutputStream.<init>(FileOutputStream.java:194)         at java.io.FileOutputStream.<init>(FileOutputStream.java:84)         at sun.security.tools.KeyTool.doCommands(KeyTool.java:902)         at sun.security.tools.KeyTool.run(KeyTool.java:172)         at sun.security.tools.KeyTool.main(KeyTool.java:166) 

Edit:

Everytime I check the folder permissions, I see that it has reverted back to read-only. There were no errors whenever I turned off read-only.

like image 433
JoJo Avatar asked Jul 06 '11 20:07

JoJo


People also ask

Where is the keystore file in Android?

The default location is /Users/<username>/. android/debug. keystore.

What is keystore file in Android?

The Android Keystore system lets you store cryptographic keys in a container to make it more difficult to extract from the device. Once keys are in the keystore, they can be used for cryptographic operations with the key material remaining non-exportable.

What is keystore in APK?

A keystore is a storage mechanism for security certificates. A public key certificate is used to sign an APK before deployment to services like the Google Play Store.


1 Answers

Below steps worked for me:

  1. Run command prompt as administrator

  2. Unchecked the read only options in C:\Program Files\Java\jdk1.6.0_25\bin This may not be required

  3. keytool -genkey -v -keystore d:\my_private_key.keystore -alias my_key_alias -keyalg RSA -keysize 2048 -validity 10000

Tell it to create it in drive D:.

like image 54
Sarker Avatar answered Sep 21 '22 22:09

Sarker