'keytool error: java.io.FileNotFoundException: C:\AndroidWorkspace\androidKey\public.jks (The system cannot find the path specified)
I am to trying to create a signed app in Android Studio, but i am stuck at this error which says
keytool error: java.io.FileNotFoundException: C:\AndroidWorkspace\androidKey\public.jks (The system cannot find the path specified)
I get this error when i am creating a new key store. i am confused, why would it search for this key, when i am trying to create a new one.
Android Studio : V1.1.0
JRE: 1.8.0_25-b18 amd64
Solution 1:[1]
Manual modifying the build.gradle(Module:app) file to sign the apk did the work. This is the code I've included in build.gradle.
signingConfigs {
release {
storeFile file("release.keystore")
storePassword "******"
keyAlias "******"
keyPassword "******"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Solution 2:[2]
Windows path might be the problem
keytool -genkey -v -keystore c:\key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
Use a path like above where the slash used is backward slanting.
Solution 3:[3]
On windows if you are trying to generate the key using the cmd
and copying the command from the android docs which is the following:
keytool -genkey -v -keystore c:\Users\USER_NAME\key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
you need to change the USER_NAME
part to what ever is your PC name which is a folder name in the users folder and then execute the code. For example if my users folder name is Taba then I have to execute this code:
keytool -genkey -v -keystore c:\Users\Taba\key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
Or you can even change the directory to where ever you like the .jks
file to be saved.
Solution 4:[4]
Delete the build directory at the app module level and then File -> Invalidate Caches / Restart... . I guess it caches some configs there.
Solution 5:[5]
If the error says "permission denied" above, then if you run the command in cmd, run cmd as administrator.
Solution 6:[6]
In my case I had to update the Java JDK, and then it worked.
Solution 7:[7]
It is clearly saying that it can't find the path to save the generated keystore. Change the path to a known location, it will work.
You can follow the steps from this article
Solution 8:[8]
run cmd as adminstrator then: keytool -genkey -v -keystore c:\key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key.jks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Brad |
Solution 2 | Divakar Rajesh |
Solution 3 | Taba |
Solution 4 | dclaudiud |
Solution 5 | Jihad Mehdi |
Solution 6 | Madhav |
Solution 7 | balu k |
Solution 8 | Rono |