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

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.

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

1 Like

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.

long story short :
open command prompt in the android folder in your react native project and run the command “gradlew clean”, then rerun the project.