如何在 Android Studio 1.3 中设置 Gradle JVM 设置 [英] How set Gradle JVM settings in Android Studio 1.3

查看:95
本文介绍了如何在 Android Studio 1.3 中设置 Gradle JVM 设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 1.3 版开始,Android Studio 将不再支持特定于 IDE 的 Gradle JVM 参数设置.Gradle JVM 设置需要在 gradle.properties 文件中设置.无论在何处执行构建(IDE、命令行或 CI 服务器),此更改对于保持构建输出一致是必要的.如果您的项目使用特定于 IDE 的 Gradle JVM 参数,Android Studio 将在项目同步时帮助您将这些设置复制到项目的 gradle.properties 文件中.Gradle"设置页面中的Gradle VM 选项"文本字段也已被删除.

Starting with version 1.3, Android Studio will no longer support IDE-specific Gradle JVM argument settings. Gradle JVM settings need to be set in gradle.properties files. This change is necessary to keep build output consistent, regardless of where the build is executed (IDE, command line or CI server.) If your project is using IDE-specific Gradle JVM arguments, Android Studio will, on project sync, help you copy those settings to your project's gradle.properties file. The "Gradle VM options" text field in the "Gradle" settings page has been removed as well.

我收到错误:

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 文件

My gradle.properties files

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

org.gradle.parallel=true

推荐答案

尝试将您的 jvmargs 更改为以下内容

Try changing your jvmargs to the following

org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

或者更小的-Xmx512m,因为您的系统没有足够的内存来创建对象堆和 jvm.

Or something smaller -Xmx512m as your system does not have enough memory to create the object heap and thus the jvm.

您也可以添加以下选项:

You can also add the following option too:

 org.gradle.daemon=true

对于那些在 macosx 上的人,我想添加以下内容

For those on macosx I like to add the following

-Djava.awt.headless=true

这篇关于如何在 Android Studio 1.3 中设置 Gradle JVM 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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