Open gradle.properties
under your project root directory and add/modify below line to
org.gradle.jvmargs=-Xmx3536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError
Specifies the JVM arguments used for the daemon process. The setting is particularly useful for tweaking memory settings. Change -Xmx3536m
to a larger value if this still does not meet your requirement.
And, modify your module level build.gradle
android {
...
dexOptions {
javaMaxHeapSize "2g"
}
...
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…