keytool error: java.io.FileNotFoundException: C:\AndroidWorkspace\androidKey\public.jks (The system cannot find the path specified)
Asked Answered
B

12

16

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

Billhook answered 22/2, 2015 at 15:23 Comment(2)
Did you set your build.gradle to sign the apk?Reareace
@GabrieleMariotti, that did the trick, i had missed that part, thanksBillhook
B
-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
    }
}
Billhook answered 16/3, 2015 at 0:50 Comment(0)
C
20

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.

Canonicate answered 12/5, 2020 at 22:35 Comment(1)
I'm an experienced developer with the same problem and now I go "DUH," that's obvious.Bordelaise
U
17

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.

Upbear answered 22/11, 2018 at 15:7 Comment(0)
S
2

If the error says "permission denied" above, then if you run the command in cmd, run cmd as administrator.

Saum answered 7/7, 2020 at 15:36 Comment(0)
R
2

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.

Remembrance answered 10/7, 2023 at 10:18 Comment(0)
A
1

Delete the build directory at the app module level and then File -> Invalidate Caches / Restart... . I guess it caches some configs there.

Assizes answered 8/9, 2019 at 11:53 Comment(0)
O
1

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.

Optimum answered 23/6, 2022 at 14:2 Comment(0)
U
0

In my case I had to update the Java JDK, and then it worked.

Upholstery answered 9/12, 2021 at 8:49 Comment(0)
S
0

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

Shelf answered 15/3, 2022 at 17:36 Comment(0)
C
0

run cmd as adminstrator then: keytool -genkey -v -keystore c:\key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key.jks

Creaky answered 26/4, 2022 at 20:57 Comment(0)
R
0

if you are using window you should run android studio as administrator and it will be ok

Renarenado answered 6/8, 2022 at 20:3 Comment(0)
F
0

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.

Foreyard answered 19/4, 2023 at 23:50 Comment(0)
B
-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
    }
}
Billhook answered 16/3, 2015 at 0:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.