通過配置gradle.properties中的參數(shù),可以調(diào)整編譯時(shí)堆棧的大小。尤其對(duì)一些方法數(shù)比較多的工程,打開了multidex編譯開關(guān),在編譯時(shí)一定要配置較大的heap,否則會(huì)出現(xiàn)如下提示甚至OOM錯(cuò)誤。
To run dex in process, the Gradle daemon needs a larger heap.
It currently has 959 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
配置文件內(nèi)容: