guys . i just try to install react native in my laptop. i've followed all setup instruction but i stiil get those error .
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar
i used genymotion with os version 5.1.0, i've setup environment variable for android_home. Any idea what i miss here ?
If this problem occurs for Windows, then the solution here is fairly simple.
Install Chocolatey
Install jdk8
Restart Command Prompt or Powershell as Administrator, and run:
Now if you run
react-native run-android
This error shouldn't show up.
Setting the missing "JAVA_HOME" system environment variable worked for me.
react-native run-android
worked fine after that.If you have the Android Studio embedded JDK, then it may cause conflicts. A workaround for this problem I've found is setting your JAVA_HOME to the default JDK location specified in Android Studio.
Find and copy tool.jar from JDK path C:\Program Files\Java\jdk1.8.0_151\lib\tool.jar
then paste it in JRE folder C:\Program Files\Java\jre1.8.0_181\lib
then delete build folder from your project/android/app/=>build
and then try react-native run-android
I had the same problem while running react-native run-android it gave me the error tool.jar not found. i solved this by adding a single line mentioned below, in gradle.properties file which is in android project. org.gradle.java.home=C:\Program Files\Java\jdk1.8.0_121
I know this question is for Windows, but this is the first result for this error on Google, so for Linux this problem could be fixed with:
sudo apt install default-jdk