How to increase maximum heap size for the Gradle daemon?

If you don’t have gradle.properties then go to your project folder you will find gradle files there create a text file and name it as gradle.properties removing .txt and then add the below code to that file.

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4096m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

and save it then open your project in Android Studio and click on sync now.

I hope it will resolve your issue, if not please let me know.

Leave a Comment