Android Studio - 提供的 javaHome 不是有效文件夹 [英] Android Studio - supplied javaHome is not a valid folder
问题描述
我决定将我的 JDK 更新为 Java 8,并安装到带有 jre
子目录的 C:\Program Files\Java\jdk1.8.0
的默认位置.
I decided to update my JDK to Java 8, and installed to the default location of C:\Program Files\Java\jdk1.8.0
with a jre
subdirectory.
我不确定 Android Studio 是如何计算出 JDK 位置的,所以我决定启动它看看.我收到以下消息:
I wasn't sure how Android Studio worked out the JDK location, so I decided to launch it and see. I got the following message:
未能完成 Gradle 执行.
Failed to complete Gradle execution.
原因:提供的 javaHome 不是有效文件夹.您提供了:C:\Program Files\Java\jdk1.7.0_45
Cause: Supplied javaHome is not a valid folder. You supplied: C:\Program Files\Java\jdk1.7.0_45
我更新了我的 JAVA_HOME 环境变量(系统和用户)以指向新路径,并尝试将其添加到我的 PATH 变量中,但每次我尝试在 Android Studio 中构建时,我都会收到相同的消息.但是,在我的环境变量中找不到引用的路径,那么它从哪里获取以及如何更改它?
I updated my JAVA_HOME environment variable (both for system and user) to point to the new path, and tried adding it to my PATH variable as well, but every time I attempt to build in Android Studio I get the same message. The quoted path is nowhere to be found in my environment variables though, so where is it getting it from and how can I change it?
谢谢
推荐答案
问题是我的项目 JDK 位置.在 Android Studio 项目工具窗口中,我右键单击根目录,选择模块设置",然后设置 JDK 位置.现在一切正常.
The problem was my project's JDK location. From the Android Studio Project tool window, I right clicked on the root directory, selected 'module settings', and set the JDK location. Everything's fine now.
这篇关于Android Studio - 提供的 javaHome 不是有效文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!