No key with alias found in keystore
Asked Answered
J

16

37

Our android project consists of mobile and wear app ( wear app is under development) and we are trying to release the mobile app. When we try to generate signed apk we get this follow message :

Error:Execution failed for task ':wear:packageRelease'.
> com.android.ide.common.signing.KeytoolException: Failed to read key
toyanathpatro from store "/home/adventure/toyanath_patro_key/toyanath_patro_key":
No key with alias 'toyanathpatro' found in keystore /home/adventure/toyanath_patro_key/toyanath_patro_key

As it reads it says failed task for :wear:packageRelease where in reality we are selecting just the mobile while choosing for signing the apk.

Can anyone point out my blunder ? Thanks in advance.

Jimmiejimmy answered 17/10, 2016 at 7:29 Comment(0)
J
68

The problem seems to be with the wrongly spelled key alias In my case the alias should have been toyanath patro where I wrongly tried to use toyanathpatro . So the best suggestion would be:

  1. Don't use space or invisible character in the key alias. as far as possible

  2. There is a small selection button (3 horizontal dots) on the right side of key alias editable field. Use that button to find the alias which resides in that signature file.

key alias editable field

Jimmiejimmy answered 8/11, 2016 at 4:19 Comment(1)
Yes, the correct alias was found by clicking the three dots. Thank you!Recommit
A
18

If you had the .Jks file before then you can get alias name by typing this command

keytool -v -list -keystore file.jks

or

keytool -v -list -keystore file.keystore

then you will have to type the password and you will get the alias name by that alias name you can create your signed release file easily.

Arbela answered 24/2, 2022 at 21:42 Comment(1)
It works for my situationSlover
F
13

In your build.gradle you have defined a signing config that it's pointing to a keystore that it's not in your code base.

Something similar to this.

android {
    ...
    buildTypes {
        release {
            signingConfig signingConfigs.staging
            ...
        }
    }
    signingConfigs {
        defaultSignature {
            keyAlias 'default'
            keyPassword 'password'
            storeFile file('default-keystore.jks')
            storePassword 'password'
        }
    }
}
Frenzied answered 17/10, 2016 at 7:41 Comment(4)
Sadly there is not have any ideas what else can cause this ?Jimmiejimmy
You didn't provide any feedback. Did you try what I suggested? Is the error message still the same? Also, please provide your complete build.gradle.Frenzied
I should be really sorry for not being able to respond as i have been in holidays with no internet literally.. As soon as i get my laptop back at home I will surely not forget to try the generous suggestion you have given.Jimmiejimmy
Helped a lot. Was able to figure out that my key's alias was some thing different. Used this to change knowledge.digicert.com/solution/SO29304.htmlFundy
C
10

In my case android studio by default create alias 'key0' and it is the only alias in the file. My fast solution: Create new key file from android studio with alias that You want. Use that new created file with "Generated Signed APK". If all goes well You could run app with properties set up in "Project Structure".

Cycle answered 17/10, 2016 at 7:30 Comment(1)
Saved my day bro!. I tried for almost an hour and your answer brought me back to life.Dovecote
R
9

After generating keystore with-

keytool -genkeypair -v -keystore my-key.keystore -alias my-alias -keyalg RSA - 
keysize 2048 -validity 10000

You should use exact name of alias in gradle.properties :-

MYAPP_UPLOAD_STORE_FILE=my-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-alias <------this name
MYAPP_UPLOAD_STORE_PASSWORD=***
MYAPP_UPLOAD_KEY_PASSWORD=***
Rozellarozelle answered 13/7, 2020 at 18:7 Comment(1)
That was the reason for me, but instead of changing gradle.properties i changed alias when generating key to -alias uploadkey which is default value for flutter.Sesterce
E
5

I had a sticky configuration which I could not get rid of. Even though I had changed the alias in the signing configuration window, it kept giving me the error "Could not find alias" with the original (wrong) alias that I first entered. I searched manually and found a file on path...

[project]/android/app/build/intermediates/signing_config/release/out/signing-config.json

...which contained the original (wrong) alias I first entered. Deleted the file and built/signed the app again. Hope it helps someone.

Esurient answered 13/6, 2019 at 23:2 Comment(0)
M
4

Build -> Rebuild project

It seems old key names are cached.

Maas answered 20/1, 2020 at 16:15 Comment(0)
L
2

I initially used key0 for building. It failed with 'Errors while building APK'. Next time, I changed it to 'key1' to work and it worked.

Linolinocut answered 28/11, 2020 at 0:50 Comment(0)
T
2

My problem was that I lost my keys and when I contacted google for making a new key I made a new one with an alias name that I don't know so to solve this in your root android project cd app and paste this command keytool -v -list -keystore yourkeystore.jks don't forget to replace the yourkeystore.jks with your key you will get output we need only the Alias name copy this alias name and past it in your key.properties file like this

storePassword=YourPassword
keyPassword=YourPassword
keyAlias=AliasNameCopiedFromLastStep
storeFile=KeyStorePath
Tournai answered 9/4, 2022 at 13:39 Comment(0)
A
1

Click Build>Edit library and dependencies .

Then click plus button in signing tab. Key Alias is as same as Alias Key while generating signed apk build.

Avocado answered 27/12, 2018 at 8:20 Comment(0)
J
0

Do not use capital keys for password. It's worked for me.

Johnnie answered 15/5, 2020 at 9:35 Comment(0)
F
0

For generating .jks keys ,

keytool -genkey -alias myKeyStore -keyalg RSA -keystore "C:\apk\fastmoneyv1.jks"

Fizgig answered 11/12, 2020 at 19:46 Comment(0)
A
0

If you are use this code when creating key

" keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload"

You have to update "keyAlias" property from key.properties

from: keyAlias=key

to: keyAlias=upload

Attaway answered 11/10, 2021 at 11:23 Comment(0)
B
0

in my case i had my keystore files already generated. I was updating my app and when i generated signed apk, i was creating new key_alias. Instead i choosed existing key alias from my keystore files and it's been resolved :)

Bughouse answered 6/1, 2022 at 15:18 Comment(0)
T
0

in my case i have space on the right of the alias and you don't see that space make sure to hover is with the mouse

Transparent answered 18/8, 2022 at 8:21 Comment(0)
B
0

My issue was that I was using the "my-key-alias" instead of "key0" as the alias name so I had to check to confirm the actual key alias name keytool -v -list -keystore yourkeystore.jks and changing MYAPP_UPLOAD_KEY_ALIAS=key0 in the app/gradle.properties file instead of MYAPP_UPLOAD_KEY_ALIAS=my-key-alias

Brandibrandice answered 29/12, 2022 at 6:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.