"Could not find tools.jar." error with react-native run-android
See original GitHub issueIssue Description
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: Windows 10 Node: 8.9.1 Yarn: 1.3.2 npm: 5.5.1 Watchman: Not Found Xcode: N/A Android Studio: Version 2.3.0.0 AI-162.4069837
Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.50.3 => 0.50.3
Target Platform: Android
Steps to Reproduce
react-native init AwesomeProject cd AwesomeProject react-native run-android
Expected Behavior
The app is built and installed on my running VM.
Actual Behavior
I get this error:
Could not find tools.jar. Please check that "C:\Program Files\Java\jre1.8.0_151" contains a valid JDK installation.
I had to set JAVA_HOME
in my system environment variables to make it work.
What happens is that in gradlew.bat
RN checks for java.exe
to test if it has found a valid JDK folder. But in my case it has found java.exe
in a JRE folder which does not contain tools.jar
.
Documentation should be updated on this page https://facebook.github.io/react-native/docs/getting-started.html and/or the error message should be improved adding “… or set JAVA_HOME to a valid one.”.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5
I experience similar error when i was setting up react-native for window OS/Android. I followed the steps on how to setup reactive-native using the option that support the use of android studio emulator to display app https://facebook.github.io/react-native/docs/getting-started.html
In one of the steps I’m require to run this code choco install -y nodejs.install python2 jdk8
I got this error
Other packages (node.js & python) was successfully installed but JDK8 always fail to install. This was the fix that I used.
Follow the instruction and JDK8 will be successfully install. Then you can run react-native init AwesomeProject cd AwesomeProject react-native run-android
I’ve research a lot on this issue. working event for me : I removed Jdk, set it up again, and the problem is solved.