Reputation: 177
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
Upvotes: 16
Views: 35605
Reputation: 236
Before:
keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
Now:
keytool -genkey -v -keystore C:\upload-keystore.jks -keyalg RSA -keysize 2048 -validity 1000
Now, it worked for me.
Upvotes: 2
Reputation: 960
In my case, I faced the same error on the server using the CMD window with Admin access. No problem with my laptop. My colleague can run the keytool command on the same server without any problem. I was unable to find out why it was not working from my end. I decided to use PowerShell and it worked.
Upvotes: 0
Reputation: 1047
if you are using window you should run android studio as administrator and it will be ok
Upvotes: 0
Reputation: 381
When generating the .aab file for Android, java SDK normally finds it hard to locate a safe default storage location, hence the Access Denied
Error.
So what I did is changed the default keytool path to the homepage of Disk D i.e D:\>
then launched cmd
in that Directory, Then pasted the command into sth like this:
D:\> keytool -genkey -v -keystore d:\appname.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias appname
Then it worked, then copy the generated file to your android/app/src
.
Upvotes: 1
Reputation: 11
run cmd as adminstrator then: keytool -genkey -v -keystore c:\key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key.jks
Upvotes: 0
Reputation: 4998
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
Upvotes: 0
Reputation: 65
If the error says "permission denied" above, then if you run the command in cmd, run cmd as administrator.
Upvotes: 2
Reputation: 4316
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.
Upvotes: 20
Reputation: 334
Delete the build directory at the app module level and then File -> Invalidate Caches / Restart... . I guess it caches some configs there.
Upvotes: 1
Reputation: 1210
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.
Upvotes: 17
Reputation: 177
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
}
}
Upvotes: -1