FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:react-native-linear-gradient:compileDebugJavaWithJavac’.
Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
When i upgraded to Mac os Big sur and run, npx react-native run-android I got this error(android). Done lot of solutions from stackoverflow, none of them are working.
I have created a fresh project and it’s working. Also some of the old projects are also working perfectly.
*react-native Version: "0.63.3",*
Please help me to find a solution ??????
Kenil Vasani
The problem is that with the update the built-in java took precedence and it doesn’t have the SDK because it’s just the runtime.
You just need to change your java home and add the java binary to your .zshrc to find your java home execute:
the output should be similar to the following:
you should take the path from the one that says SDK in my case
after that, you just add the following to the end of your .zshrc that should be in your home.
You can edit it with (if you decide to use vim you can exit writing :wq! and pressing enter)
add the following:
where the/path/you/copied/before in my case would be
save the file and close all your terminals and open them again.
The error should be solved.