When a docker or a machine executor runs out of ram while compiling an android application the process that will be killed is Gradle as it uses such a large amount of ram. To resolve this issue you need to either increase the resources available or you can set a limit within your gradle.properties
Prerequisites
The following error will be seen if you are running out of ram. You can also check the resources tab in your build to confirm if you are reaching 100% ram usage.
FAILURE: Build failed with an exception. * What went wrong: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
Resolution
If you would like to upgrade the resource class please use the following guide here
To limit your ram open your gradle.properties you will need to edit the jvmargs as shown below you can raise or lower these values to suit but if you are running into the error shown above please try reducing the amount of both values.
org.gradle.jvmargs=-Xms512m -Xmx2048m
Outcome
Your build should no longer show the error in regards to the Gradle build daemon disappearing due to it being killed.
Comments
Article is closed for comments.