No key with alias found in keystore

45,239

Solution 1

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

Solution 2

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'
        }
    }
}

Solution 3

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".

Solution 4

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.

Solution 5

Build -> Rebuild project

It seems old key names are cached.

Share:
45,239
erluxman
Author by

erluxman

Open for remote jobs You can also hire me through upwork https://wwwerluxman.com https://www.upwork.com/freelancers/~01ca1c56b1ce85b4dd

Updated on February 09, 2022

Comments

  • erluxman
    erluxman over 2 years

    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.