Execution failed for task ':app:compileDebugJavaWithJavac'. > Could not find tools.jar

后端 未结 2 1554
别跟我提以往
别跟我提以往 2021-01-14 15:58

I get this error while executing

react-native run-android

I have tried copying tools.jar file to JRE installation location, reinstalled JD

相关标签:
2条回答
  • 2021-01-14 16:22

    For MacOS, here are the steps:

    1. Get Current java version ( recommended 1.8 ):
    $ java -version  
    java version "1.8.0_271"
    Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
    Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
    
    1. CD to your Java home path
    $ cd /Library/Java/JavaVirtualMachines
    $ ll
    total 0
    drwxr-xr-x  3 root  wheel    96B 24 Out 09:24 adoptopenjdk-15-openj9.jre
    drwxr-xr-x  3 root  wheel    96B 30 Dez 20:18 jdk1.8.0_271.jdk
    
    1. CD to the current java home shown at step 1 (" java 1.8.0_271" ):
    $ cd jdk1.8.0_271.jdk/Contents/Home
    
    1. Copy the current path to clipboard:
    $ pwd | pbcopy   
    
    1. Finally, open the gradle.properties file (here I'm using VSCode) and set the org.gradle.java.home variable:

    org.gradle.java.home=<path_to_current_java_home>

    Her is an working example:

    0 讨论(0)
  • 2021-01-14 16:44

    Add this to gradle.properties:

    org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_91
    

    Don’t forget to use double back slashes. For example:

    org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_144\
    
    0 讨论(0)
提交回复
热议问题