[英]Could not find tools.jar React Native Android In windows 10
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. 我使用genymotion与os版本5.1.0,我为android_home设置环境变量。 Any idea what i miss here ? 知道我想念的是什么吗?
Setting the missing "JAVA_HOME" system environment variable worked for me. 设置缺少的“JAVA_HOME”系统环境变量对我有用。
react-native run-android
worked fine after that. react-native run-android
在那之后react-native run-android
良好。 Setting up appropriate JDK (not JRE. JRE does not have tools.jar
) version (Eg JDK 1.7x) path as the JAVA_HOME
would resolve this issue. 设置适当的JDK(不是JRE.JRE没有tools.jar
)版本(例如JDK 1.7x)路径,因为JAVA_HOME
将解决此问题。
Please check your computer's environment variables and set JAVA_HOME
if it has not already been setup. 请检查计算机的环境变量并设置JAVA_HOME
如果尚未设置)。
I'm gonna go on a long shot here. 我要在这里远射。 There is a tools.jar in java libs folder.[the java sdk that is] java libs文件夹中有一个tools.jar。[java sdk是]
Usually all these frameworks and ides have a lib folder themselves. 通常所有这些框架和ides本身都有一个lib文件夹。 and it is missing said tools.jar. 它缺少所说的tools.jar。 Just copy paste it there. 只需将其粘贴即可。
I had the same problem while running react-native run-android it gave me the error tool.jar not found. 我在运行react-native run-android时遇到了同样的问题它给了我错误的tool.jar找不到。 i solved this by adding a single line mentioned below, in gradle.properties file which is in android project. 我通过在android项目中的gradle.properties文件中添加下面提到的单行来解决这个问题。 org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_121 org.gradle.java.home = C:\\ Program Files \\ Java \\ jdk1.8.0_121
If you have the Android Studio embedded JDK, then it may cause conflicts. 如果你有Android Studio嵌入式JDK,那么它可能会导致冲突。 A workaround for this problem I've found is setting your JAVA_HOME to the default JDK location specified in Android Studio. 我发现这个问题的解决方法是将您的JAVA_HOME设置为Android Studio中指定的默认JDK位置。
If this problem occurs for Windows, then the solution here is fairly simple. 如果Windows出现此问题,则此处的解决方案非常简单。
Restart Command Prompt or Powershell as Administrator, and run: 以管理员身份重新启动命令提示符或Powershell,然后运行:
choco install jdk8
Now if you run 现在,如果你跑
react-native run-android
This error shouldn't show up. 此错误不应出现。
Just to add another data point for people pulling their hair out. 只是为人们拉头发添加另一个数据点。 I think a java update may have messed up my environment that was working fine 2 months ago. 我认为java更新可能搞砸了我的环境2个月前工作正常。 The combination of what worked for me: 对我有用的组合:
Set JAVA_HOME
to 1.7
, NOT 1.8
. 将JAVA_HOME
为1.7
,而不是1.8
。
I had 2 1.8 versions installed and neither worked. 我安装了2个1.8版本,但都没有工作。
Find and copy tool.jar from JDK path C:\\Program Files\\Java\\jdk1.8.0_151\\lib\\tool.jar 从JDK路径C:\\ Program Files \\ Java \\ jdk1.8.0_151 \\ lib \\ tool.jar中查找并复制tool.jar
then paste it in JRE folder C:\\Program Files\\Java\\jre1.8.0_181\\lib 然后将其粘贴到JRE文件夹C:\\ Program Files \\ Java \\ jre1.8.0_181 \\ lib中
then delete build folder from your project/android/app/=>build 然后从你的项目/ android / app / => build中删除build文件夹
and then try react-native run-android 然后尝试react-native run-android
我知道这个问题适用于Windows,但这是Google上出现此错误的第一个结果,因此对于Linux,此问题可以通过以下方式解决:
sudo apt install default-jdk
I have deleted " \\react_native_project_path\\android " directory and run 我删除了“ \\ react_native_project_path \\ android ”目录并运行
reactive-native android
then run .. 然后运行..
reactive-native run-android
Then the error is gone 然后错误就消失了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.