要在进程中运行dex,Gradle守护程序需要更大的堆。它目前大约有1024 MB

时间:2017-11-19 05:02:19

标签: android gradle heap dex

我在Android Studio中构建APP时收到此消息:

Running dex as a separate process.

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

我不确切地知道这意味着什么,因为我是新手,以及如何解决它。我有一个build.gradle(项目),一个settings.gradle和build.gradle(APP)。我需要修改哪一个以及如何修改?

谢谢!

1 个答案:

答案 0 :(得分:1)

在项目org.gradle.jvmargs=-Xmx2048M中设置gradle.properties。有关详细信息,请参阅https://docs.gradle.org/current/userguide/build_environment.html

您还可以在build.gradle

中添加此行
android {
    dexOptions {
        javaMaxHeapSize "4g"
    }
}