I'm trying to build a release .apk file in React Native without success.
I followed all the instructions here, but i always get the same result after running gradlew assembleRelease
in /my-project/android path:
:app:validateSigningRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release
I'm using Windows 10 and i suspect it's something with the edit of file ~/.gradle/gradle.properties
From my understanding ~ is c:\Users\User I even got a c:\Users\User.gradle folder built-in.
I had the same error message, but I just fixed it.
As mention in RN documentation Facebook Doc
Edit the file ~/.gradle/gradle.properties or android/gradle.properties
I edited another file located here
~/MYAPP/android/gradle.properties
Then did clean and build again. I hope this will help.
I see that this thread has been inactive for almost two months, but I figured I could write down what caused this problem for me, maybe it helps someone else in the future.
It was in fact pretty simple: when I copied the configuration from the documentation the formatting was not kept, it either pasted everything on one line, or on multiple ones, but breaking the lines also in places where it shouldn't. So you just need to make sure the lines in the build.gradle file look like:
keyPassword MYAPP_RELEASE_KEY_PASSWORD
and not
keyPassword
MYAPP_RELEASE_KEY_PASSWORD
And that is it.
You can try setting your gradle.properties variables as environment variables and change your signinConfig release in android/app/build.gradle to something like:
signingConfigs {
release {
storeFile file(String.valueOf(System.getenv("GRADLE_KEYSTORE")))
storePassword System.getenv("GRADLE_KEYSTORE_PASSWORD")
keyAlias System.getenv("GRADLE_KEYSTORE_ALIAS")
keyPassword System.getenv("GRADLE_KEYSTORE_ALIAS_PASSWORD")
}
}
I'm on Mac but I'm guessing environment variables should work better on Windows than the global .gradle/gradle.properties file
Hope it helps
Just a note for anyone else that comes across this looking for help. If you have uploaded the keystore and the password and alias to the appcenter then you do not need to have any settings in the android/gradle.properties or android/app/build.gradle the keystore file and env variables uploaded will be used to sign the apk after it has been build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With