Could not find tools.jar React native Android in Mac OSX

13,040

Solution 1

This error pops up, when some plugins of react-native like masked-view unable to locate tools.jar path in your machine which exists inside JDK home lib directory.

With respect to this question, what you did is almost right but you added the Internet Plugins path which is incorrect. You have to add the jdk path of your machine.

Locate JDK path :

If your JAVA_HOME variable exists then you can find directly via terminal using vim .zshrc or vim .bashrc command where must exists a path similar to /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk{Your Machine JDK Version}/Contents/Home (Copy this JAVA_HOME path)

After getting path of JDK, under android folder in gradle.properties file add this line

org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk{"REPLACE_IT_WITH_YOUR_JDK_VERSION"}/Contents/Home

Hope this will help you or somebody else!

Thanks :)

Solution 2

You should download JDK, finish the installation and add lib's path to PATH. In my case:

/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/lib

It's at the same level with bin, which is:

/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin
Share:
13,040
Abdennour TOUMI
Author by

Abdennour TOUMI

Instructor of Course Run Kubernetes on AWS with EKS. Certified: 🥇 CKA - Kuberntes administrator k8s 🥇 CKAD - Kuberntes App Dev k8s 🥇 AWS DevOps Engineer - Professional devops aws 🥇 Professional Cloud Architect - Google Cloud google-cloud-platform 🥇 AWS Solutions Architect - Professional architecture aws 🥇 Red HAT Certified in Ansible Automation ansible devops 🥇 Red HAT Certified in Openshift Administration ocp 🥇 Red HAT Certified in Openshift App Development ocp 🥇 Red HAT Certified Engineer redhat 🏅 AWS Solutions Architect - Associate architecture 🏅 AWS SysOps Administrator - Associate aws 🏅 AWS Developer - Associate aws 🏅 Linux Professional Institute (LPIC-1) linux 🏅 Professional ReactJS Developer (Udacity Nanadegreee) react frontend 🏅 Fullstack web Developer (Udacity Nanadegreee) python flaskrest Top 1 Stackoverflow reputation in my country Tunisia since 2017 Read more about me: in.abdennoor.com

Updated on June 23, 2022

Comments

  • Abdennour TOUMI
    Abdennour TOUMI almost 2 years

    I reach this step :

    reactive-native run-android ; 
    

    When I run echo $JAVA_HOME, i got the full path to JDK directory :

    /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    

    I add that path to ./android/gradle.properties :

    org.gradle.java.home=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/
    

    I got the same error which is :

    ..... .... :app:generateDebugSources UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:compileDebugJavaWithJavac FAILED

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

      Could not find tools.jar

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    .....