gpt4 book ai didi

android - 如何指示 Gradle 从不同位置使用 Java?

转载 作者:行者123 更新时间:2023-11-29 02:18:22 26 4
gpt4 key购买 nike

我在 Android Studio 中构建我的测试应用程序,然后在事件日志中它说:

Android Studio is using this JDK location: C:\Program Files\Android\Android Studio\jre which is different to what Gradle uses by default: C:\Program Files (x86)\Java\jdk1.8.0_181 Using different locations may spawn multiple Gradle daemons if Gradle tasks are run from command line while using Android Studio.

然后给出了这些选项:

  1. More info...
  2. Set Android Studio to use the same JDK as Gradle and sync
  3. Do not show this warning again

我点击了:

Set Android Studio to use the same JDK as Gradle and sync

然后我的应用不想再构建了。

这是错误:

Gradle sync failed: Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.

For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/5.4.1/userguide/gradle_daemon.html

Process command line: C:\Program Files (x86)\Java\jdk1.8.0_181\bin\java.exe -Xmx1536m -Dfile.encoding=windows-1252 -Duser.country=ZA -Duser.language=en -Duser.variant -cp C:\Users\{MyUserName}\.gradle\wrapper\dists\gradle-5.4.1-all\3221gyojl5jsh0helicew7rwx\gradle-5.4.1\lib\gradle-launcher-5.4.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.4.1

Please read the following process output to find out more:

Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap Consult IDE log for more details (Help | Show Log) (16 s 166 ms)

我检查了事件日志:

我认为以前它是这样做的:

Instructing gradle to use java from C:/Program Files/Android/Android Studio/jre

现在它是这样说的:

Instructing gradle to use java from C:/Program Files (x86)/Java/jdk1.8.0_181

如何将其设置回原来的方式,以便我的应用可以重新构建?

任何帮助/建议将不胜感激

最佳答案

转到文件、项目结构、SDK 位置并将 JDK 位置下拉列表更改为 JAVA_HOME。

Project structure in Androdi Studio 3.6 beta

关于android - 如何指示 Gradle 从不同位置使用 Java?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58432643/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com