android - Android Studio中重复gradle属性错误

标签 android android-studio gradle

我已经在android studio 2新版本上启动了一个新项目。然后显示“错误:无法启动守护进程。”这些行显示出来。
然后我通过添加此行来更改我的Gradle属性

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m



但是,当我开始一个新项目时,此行再次出现:
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 
https://docs.gradle.org/2.14.1/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 1572864KB object heap

我如何永久设置Gradle属性以避免每次发生这种情况。

最佳答案

打开位于androidStudio/bin/studio.vmoptions的文件

它应该看起来像这样,如果不作相应更改

#
# *DO NOT* modify this file directly. If there is a value that you would like to override,
# please add it to your user specific configuration file.
#
# See http://tools.android.com/tech-docs/configuration
#
-Xms256m
-Xmx1280m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-da
.......

这很可能会解决您的问题。

关于android - Android Studio中重复gradle属性错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40786623/

相关文章:

java - 删除文件中的一行 (Android/java)

android - gradle - 依赖项中的库重复

java - Gradle - 公司存储库需要 ssl 客户端证书

android - 未为模块 "Example-Example"指定 APK 路径

java - 加密和解密字符串

android - 如何在操作栏中构建类似于搜索框的Gmail?

java - ADK vs JDK vs SDK 区别?

android - Cardview 里面有分隔线

Android Studio 在尝试安装插件时不断重置 Gradle 版本

ListView的Android LinearLayout权重和wrap_content