问题
I just updated the Android Studio to 3.5 Beta 1 and I'm getting
Expiring Daemon because JVM heap space is exhausted
message while the build is running. Also, the build is taking more time to complete. Does anyone have any idea regarding this?
回答1:
I was able to solve this for my React Native project by configuring the following:
// gradle.properties
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
and
// app/build.gradle
android {
dexOptions {
javaMaxHeapSize "3g"
}
}
回答2:
This can be fixed by increasing the configured max heap size for the project.
Through IDE:
Add the below lines into the gradle.properties file. Below memory size can be configured based on the RAM availability
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2560m
Through GUI:
In the Settings, search for 'Memory Settings' and increase the IDE max heap size and Daemon max heap size as per the system RAM availability.
来源:https://stackoverflow.com/questions/56075455/expiring-daemon-because-jvm-heap-space-is-exhausted