Agu
Lost but trying
Profile
Posts: 98
Reg: Mar 06, 2014
GRANADA
980
02/23/17 03:15 PM (7 years ago)

android studio: Gradle daemon needs a larger heap

Hello, when I try to run app for testing on my phone, this message appears on gradle console in android studio: To run dex in process, the Gradle daemon needs a larger heap. It currently has approximately 1024 MB. For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB. To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties. For more information see https://docs.gradle.org/current/userguide/build_environment.html How can I fix it? Thanks in advance. Agu.
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
02/27/17 10:17 AM (7 years ago)
 
Agu
Lost but trying
Profile
Posts: 98
Reg: Mar 06, 2014
GRANADA
980
like
03/02/17 01:44 PM (7 years ago)
Thanks...doesn´t work. Same problem.
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
03/03/17 12:12 AM (7 years ago)
Increase Gradle's heap size and enable dex-in-process Dex-in-process runs the DEX compiler within the build process rather than in a separate VM process—this makes both incremental and clean builds faster. By default, new projects that are created with Android Studio 2.1 and higher allocate enough memory to the build process to enable this feature. If you didn't create your project using Android Studio 2.1 or higher, you need to set the Gradle daemon's maximum heap size to at least 1536 MB. The following sample sets the Gradle's heap size to 2048 MB in your project's gradle.properties file: org.gradle.jvmargs = -Xmx2048m Some larger projects may benefit from an even bigger Gradle heap size. However, If you're using a low memory machine, you may need to configure the IDE to use less memory. To learn how changing the amount of resources you allocate to the IDE and Gradle affects your build performance, go to the section about profiling your build. Note: If the Gradle daemon is already running, you need to stop the process before initializing it with new settings. You can terminate the Gradle daemon by selecting View > Tool Windows > Terminal and entering the following command: gradlew --stop. If you define a value for android.dexOptions.javaMaxHeapSize in your module's build.gradle file, which controls the heap size for the DEX compiler, you need to set Gradle's heap size such that it is both 512 MB larger than the value you set for the javaMaxHeapSize property and is at least 1536 MB. For example, if you set javaMaxHeapSize to 1280 MB, you must set org.gradle.jvmargs to at least 1792 MB (1280 + 512)—though an even larger heap size is better. You do not need to specify a value for javaMaxHeapSize to enable dex-in-process. If you exclude javaMaxHeapSize from your build configuration, simply ensure that you set Gradle's heap size to 1536 MB or higher
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.