Reputation: 5590
Execution failed for task ':app:packageRelease'.
Failed to read key my-key-alias from store
"/Users/MichaelLeung/GHRepos/MyApp/android/app/my-release-
key.keystore": Keystore was tampered with, or password was incorrect
I'm positive my password is correct; I've gone through the steps that Facebook lists on the React Native docs multiple times.
Upvotes: 7
Views: 8901
Reputation: 209
I tried :
$ ./gradlew clean
$ ./gradlew bundleRelease
and it worked.
Upvotes: 0
Reputation: 1
Don't be confused! It's actually a simple mistake put your password: Not in
Users/YourName/.gradle/gradle.properties
But in
Users/YourName/.gradle/gradle.properties
I was trying to build based on a project-specific gradle.properties (i.e. at projectDir/android/gradle.properties), but a global gradle.properties I had configured during a previous project was being used instead. The fix for me was to delete my global gradle.properties (i.e Users/YourName/.gradle/gradle.properties)
Upvotes: -1
Reputation: 1558
So if you were trying to generate a signed APK and used a no ASCII letter, you'd probably get this error.
Execution failed for task ':app:packageRelease'.
com.android.ide.common.signing.KeytoolException: Failed to read key my-key-alias from store "/Users/.../.../.../android/app/my-release-key.keystore": keystore password was incorrect
I couldn't find a way to reset the old password.
Thankfully there is a work around, using the Android Studio.
First I had to remove all the code from gradle.properties and build.gradle, (that I had to add according to the docs..
This solution is from a a comment here: Keystore password was incorrect "I am facing the same issue. Using Build -> Generate Signed APK in android studio works, but putting the config in build.gradle doesn't."
Then use the "signing/keytool UI that's part of Android Studio", which can be found in Build -> Generate Signed Bundle/APK ...
There you can create a new key store password and a key password WHICH HAVE TO BE THE SAME!!!
Note after finishing, Android Studio saves the app-release.apk file in android -> app -> release.
Happy coding :)
Upvotes: 3
Reputation: 15935
I took help from Yoruba's answer, I was trying to build app left by another developer
I was trying to build keystore file using
keytool -genkey -v -keystore playnice.keystore -alias playnice -keyalg RSA -keysize 2048 -validity 10000
the command prompt then asks for password, and this password should be the same as set in build.gradle file.
In my case build.gradle file had Keys instead of password, thus I looked in gradle.properties to find value of that key
Upvotes: -1
Reputation: 2780
I had the same problem. After hard coded the settings in the build.gradle, instead off set it in the gradle.properties, is was working.
signingConfigs {
release {
//if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file("key.keystore")
storePassword "****"
keyAlias "myKey"
keyPassword "****"
// }
}
}
After further testing with java.lang.System.console(MYAPP_RELEASE_STORE_PASSWORD) I saw that there was a space after my password.
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
java.lang.System.console(MYAPP_RELEASE_STORE_PASSWORD)
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
Upvotes: 2