1
votes

So I don't know what I clicked on but after I did, everything, like literally everything stopped working.

Current error message:

ERROR: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/5.4.1/userguide/gradle_daemon.html Process command line: C:\Program Files (x86)\Java\jdk1.8.0_181\bin\java.exe -Xmx1536m -Dfile.encoding=windows-1252 -Duser.country=NL -Duser.language=nl -Duser.variant -cp C:\Users\MSahl.gradle\wrapper\dists\gradle-5.4.1-all\3221gyojl5jsh0helicew7rwx\gradle-5.4.1\lib\gradle-launcher-5.4.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.4.1 Please read the following process output to find out more: ----------------------- Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap

Even after uninstalling everything the problem still persists.

5
In the Gradle wrapper properties, you'll need to reduce -Xmx1536mOneCricketeer
@cricket_007 that line is a default given line, its already added and doesn't fix anything.Molinho
Your value is -Xmx1536m, the VM needs at least 1572864KB. See my answer here: stackoverflow.com/a/58169849/3999808Zun
I'm saying you need to lower it. According to docs.gradle.org/5.4.1/userguide/gradle_daemon.html - the default is only 512mOneCricketeer

5 Answers

2
votes

Open gradle.properties:
Max limit from Gradle 5.4.1 document:
If the requested build environment does not specify a maximum heap size, the Daemon will use up to 512MB of heap.

org.gradle.jvmargs=-Xmx512m
Or you can remark memory setting. The system will set by itself.

The rest of content of my file:
======================================================================
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
======================================================================
Now, File >> Sync Project with Gradle Files

1
votes

add this line into gradle.properties

org.gradle.jvmargs=-Xmx1536m

then clean and rebuild project

0
votes

My Android Studio was working fine. But executing Gradle from command line gave this same error 'could-not-reserve-enough-space-for-1572864kb-object-heap'

Looks like, it was because Gradle couldn't find java

Defined JAVA_HOME system variable, pointing to the same path Android studio was using. (get it from Studio > project structure > SDK Location > JDK Location)

Worked for me.

0
votes

restoring my system to an earlier date resolved the issue. it was an update to the jdk the cause

0
votes

Press Ctrl+Enter to run highlighted section in android studio.