I\'ve setup the environment for react native on Windows. But when I run the command
react-native run-android
I get the following errors -<
I encountered this error while running the following command in macOS
./gradlew assembleRelease --stacktrace
and got the exact error posted. I solved the problem by setting $JAVA_HOME environment variable to your JDK installation. In my case I used the bundled JDK in Android Studio for macOS:
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
for Windows, just add JAVA_HOME to your user or system variables pointing to
"C://Program Files/Java/jdk_1.x_"
folder and try running react-native run-android again.