无法在Android Studio 2.1.1的gradle.properties文件中设置JVM参数gradle [英] JVM arguments gradle cannot be set in gradle.properties file for Android Studio 2.1.1

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

问题描述

- 在Mac OS X上运行Android 2.1.1

-Running Android 2.1.1 on Mac OS X

-App不在Android手机上。

-App is not on Android phone.

gradle.properties文件的内容

org.gradle.jvmargs=-Xmx2048M

悬停时,IDE表示它是未使用的属性。它也应该是深蓝色而不是灰色。

When hovering, the IDE indicates it is an unused property. It should also be dark blue instead of grey.

输出:

:MyProjectDirName:transformClassesWithInstantRunSlicerForDebug
:MyProjectDirName:transformClassesWithDexForDebug
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon       
to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project   
gradle.properties.
For more information see   
https://docs.gradle.org/current/userguide/build_environment.html

编译器的输出清楚地表明它丢弃了 gradle.properties 文件的内容。

The output of the compiler clearly indicates it discards the contents of the gradle.properties file.

内容build.gradle

android {
    dexOptions {
        javaMaxHeapSize "2g"
    }
}

使用这些设置也没有成功:

Played with these settings aswell, no success:

推荐答案

尝试在gradle.properties文件中添加'org.gradle.daemon = true'

Try to add the 'org.gradle.daemon=true' inside gradle.properties file at

/Users/<username>/.gradle/ (Mac)

C:\Users\<username>\.gradle (Windows)

根据

https://stackoverflow.com/a/33184794/1915831

https://stackoverflow.com/a/19500539/1915831

这篇关于无法在Android Studio 2.1.1的gradle.properties文件中设置JVM参数gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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