question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Could not find tools.jar." error with react-native run-android

See original GitHub issue

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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
Seunopecommented, Feb 15, 2018

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

Could not find tools.jar. Please check that “C:\Program Files\Java\jre1.8.0_151” contains a valid JDK installation.

Other packages (node.js & python) was successfully installed but JDK8 always fail to install. This was the fix that I used.

  1. Ensure your internet connection is good.
  2. run

choco install jdk8

Follow the instruction and JDK8 will be successfully install. Then you can run react-native init AwesomeProject cd AwesomeProject react-native run-android

0reactions
batuhantomacommented, Nov 7, 2018

I’ve research a lot on this issue. working event for me : I removed Jdk, set it up again, and the problem is solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find tools.jar React Native Android In windows 10
Press WIN+Pause on keyboard. · Click advanced system settings. · Click "Environment variables". · Click "New" under "System variables". · Type " ...
Read more >
"Could not find tools.jar." error with react-native run-android ...
Press WIN+Pause on keyboard. Click advanced system settings. Click "Environment variables". Click "New" under "System variables". Type " ...
Read more >
Could not find tools.jar - DEV Community ‍ ‍
Go to your project, open android folder > gradle.properties file > add below line org.gradle.java.home=/Applications/Android Studio.app/Contents ...
Read more >
Could not find tools.jar React Native Android In windows 10
Android : Could not find tools. jar React Native Android In windows 10 [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] ...
Read more >
Could not find tools.jar. Please check that C:\Program Files ...
1.Please make sure both JDK and jre are on same versionError: Could not find tools. jar. Please check that C:\Program Files\Java\jre1.8.0_151 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found