Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native Keystore file not set for signing config release

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.

like image 651
Ariel Avatar asked Mar 25 '17 19:03

Ariel


Video Answer


4 Answers

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.

like image 160
Daniel Avatar answered Oct 09 '22 02:10

Daniel


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.

like image 43
mishu Avatar answered Oct 09 '22 00:10

mishu


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

like image 3
guitoof Avatar answered Oct 09 '22 01:10

guitoof


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

like image 2
Luke Grayland Avatar answered Oct 09 '22 00:10

Luke Grayland