I'm using gradle (assembleRelease) to generate the release apk.
I have saved the keystore file in project/app/filename.keystore (Within the application)
I have specified details related to signing in gradle.properties file
Error:Execution failed for task ':app:package<flavor>Release'.
> Failed to read key from keystore
My problem was that I had entered a random
keyAlias. When trying to sign the apk using the IDE (IntlliJ Idea and Android Studio: Build menu -> generate signed APK), by clicking the ellipse button (
...) next to the textbox for entering key alias, I found the correct key alias that I had earlier set for my keystore. Double check that you are not entering some ad-hoc random password and keyAlias for your keystore as they should be identical to the password and key alias you set for your keystore when creating it.
If you have forgotten either the password or the key alias, I am afraid you have to create a new keystore as you cannot read your keystore without these. I suggest saving these two properties (and attaching your keystore file) in a password manager like Lastpass, as you need them in future.