任务“:app:compileDebugJavaWithJavac"执行失败.>找不到 tools.jar [英] Execution failed for task ':app:compileDebugJavaWithJavac'. > Could not find tools.jar

查看:39
本文介绍了任务“:app:compileDebugJavaWithJavac"执行失败.>找不到 tools.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行时遇到这个错误

I get this error while executing

react-native run-android

我尝试将 tools.jar 文件复制到 JRE 安装位置,重新安装 JDK 和 JRE,检查路径的环境变量.没有任何效果.

I have tried copying tools.jar file to JRE installation location, reinstalled JDK and JRE, checked environment variables for path. Nothing worked.

它返回以下异常

info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
> Task :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that C:\Program Files (x86)\Java\jre1.8.0_211 contains a valid JDK installation

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

推荐答案

将此添加到 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\

这篇关于任务“:app:compileDebugJavaWithJavac"执行失败.>找不到 tools.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆