Failed to read <key> from store ... Keystore was tampered with or password was incorrect


#1

I have the following in my platforms/android/release-signing.properties file:
storeFile=…/…/key.keystore
keyAlias=mykey

I generated key.keystore with:
keytool -genkey -v -keystore key.keystore -alias mykey -keyalg RSA -keysize 2048 -validity 10000

I run:
ionic build android --release

and I get the error:
com.android.ide.common.signing.KeytoolException: Failed to read key mykey from store "<path here>\..\..\key.keystore": Keystore was tampered with, or password was incorrect

Do I need to explicitly give it the password? If so how?

Thanks for any help.


#2

OK, I got it.

For reference, I needed to update the release-signing.properties to:
storeFile=…/…/key.keystore
keyAlias=mykey
keyPassword=password
storePassword=password

These override the setting in build.gradle:
signingConfigs {
release {
// These must be set or Gradle will complain (even if they are overridden).
keyAlias = ""
keyPassword = “__unset” // And these must be set to non-empty in order to have the signing step added to the task graph.
storeFile = null
storePassword = “__unset”
}
}


#3

To me it is completely inacceptable that I have to add the passwords to the keystore file. Could someone please clarify whether there is a way where the password prompt is re-established.