jenkins使用gradle出现“To run dex in process, the Gradle daemon needs a larger heap.”

  • A+
所属分类:Android异常
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

由于gradle编译时的内存资源不足,需要配置更大的内存资源。
再项目根目录查找gradle.properties这个文件,如果没有就新建一个,加入以下内容

org.gradle.daemon=true
org.gradle.jvmargs=-Xmx3048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true

然后重新再运行就可以了。

avatar