React Native: Could not find tools.jar
* What went wrong:
Execution failed for task ‘:app:compileDebugJavaWithJavac’.
> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_161 contains a valid JDK installation.
Solution:
Setting the missing “JAVA_HOME” system environment variable worked for me.
Press WIN+Pause on keyboard.
Click advanced system settings.
Click “Environment variables”.
Click “New” under “System variables”.
Type “JAVA_HOME” in the Variable name field.
Type the path to the JDK in the Value field. For me the correct path with short filename was “C:\PROGRA~1\Java\jdk1.8.0_66”. Your path will vary depending on the installed version.
Click OK, and OK in previous window too.
Restart any command prompts or restart the computer.
react-native run-android worked fine after that.