从版本 1.3 开始,Android Studio 将不再支持 IDE 特定的 Gradle JVM 参数设置。 Gradle JVM 设置需要在 gradle.properties 文件中设置。无论构建在何处(IDE、命令行或 CI 服务器)执行,此更改对于保持构建输出一致是必要的。
如果您的项目使用特定于 IDE 的 Gradle JVM 参数,Android Studio 将在项目同步时帮助您将这些设置复制到项目的 gradle.properties 文件中。
“Gradle”设置页面中的“Gradle VM 选项”文本字段也已被删除。
我收到错误:
Error: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 guide chapter on the daemon at http://gradle.org/docs/2.4/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
我的 gradle.properties 文件
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
尝试将 jvmargs 更改为以下内容
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
或者更小的东西-Xmx512m因为您的系统没有足够的内存来创建对象堆以及 jvm。
您还可以添加以下选项:
org.gradle.daemon=true
对于 macOS 上的用户,我想添加以下内容
-Djava.awt.headless=true
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)