Thursday, November 3, 2016

[Android][Resolved] keytool error: java.io.FileNotFoundException: my-release-key.keystore (Access is denied)

 

Error message :
C:\Program Files\Java\jdk1.8.0_65\bin>keytool -exportcert -alias androiddebugkey
 -keystore ~/.android/debug.keystore -list -v -storepass android
keytool error: java.lang.Exception: Keystore file does not exist: ~/.android/deb
ug.keystore
java.lang.Exception: Keystore file does not exist: ~/.android/debug.keystore
        at sun.security.tools.keytool.Main.doCommands(Main.java:742)
        at sun.security.tools.keytool.Main.run(Main.java:340)
        at sun.security.tools.keytool.Main.main(Main.java:333)
I found answer at stackoverflow by Sarker helps :
http://stackoverflow.com/questions/6602422/access-denied-when-creating-keystore-for-android-app#answer-16386236

Run command with administrator permission:
keytool -genkey -v -keystore C:\Users\YOUR_USERNAME\android_private_key.keystore -alias KeyAlias -keyalg RSA -keysize 2048 -validity 10000
Edit the text in orange to filename you like and the text in green to the location you want save the keystore file.

Beware the target folder must be existed otherwise you may get a java.io.FileNotFoundException, for example:
[Storing d:\my_private_key.keystore]
keytool error: java.io.FileNotFoundException: d:\my_private_key.keystore (The de
vice is not ready)
java.io.FileNotFoundException: d:\my_private_key.keystore (The device is not rea
dy)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
        at sun.security.tools.keytool.Main.doCommands(Main.java:1141)
        at sun.security.tools.keytool.Main.run(Main.java:340)
        at sun.security.tools.keytool.Main.main(Main.java:333)

Reference:
http://stackoverflow.com/questions/6602422/access-denied-when-creating-keystore-for-android-app

1 comment :