androidgradleandroid-gradle-plugingradle.properties

How can I set org.gradle.jvmargs=-Xmx5120M in the project gradle.properties?


I'm getting this

To run dex in the process, the Gradle daemon needs a larger heap.

error and I want to add org.gradle.jvmargs=-Xmx5120M to my gradle.properties to fix this issue. However, I can't find the gradle.properties file in my project.


Solution

  • I can help with the above.

    Changing the gradle heap size will not assist you so much but you can try this two ways to evade this type of error 'Gradle daemon' error.

    Close all other application running and restart the android studio. If the error persist, use the second method.

    That is close unnecessary processes running on the background by holding down alt+ctrl and then click del button to open the task manager window.

    Mostly, browsers tend to run on the background and consume alot of memory that is why you see that Gradle daemon error.

    For example, close chrome process which is running on the background and either restart the android studio or rebuild the project