Kotlin - [daemon] Invalid maximum heap size: -Xmx1g -Xshare:off

Viewed 156

After updating IntelliJ and pulling the newest code from the repo for my project, I keep getting build errors like Kotlin: Unresolved reference, Kotlin: Too many arguments for public fun, etc., that I wasn't getting before.

I am trying to run Reload All Gradle Projects through IntelliJ, but then I keep getting the following error:

[daemon] Invalid maximum heap size: -Xmx1g -Xshare:off

I was able to build project fine for the past few months, but now when I have pulled the latest from the remote repo I keep getting that error when I try to Reload All Gradle Projects. This is how my gradle.properties file looks like:

org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xms512M -Xmx2g -XX:MaxMetaspaceSize=1g -Xshare:off -Dkotlin.daemon.jvm.options="-Xmx1g -Xshare:off"
org.gradle.logging.level=lifecycle
org.gradle.console=auto

Since it is a part of our git repo, I am afraid to do any changes there. I have read that it could be an issue with having 32 bit JDK instead of the 64 bit, but I have the right version:

openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)

Even if I comment out the org.gradle.jvmargs in gradle.properties file, I get build errors:

Redeclaration: Glow_kotlinAppConventionsPlugin

I have tried to run ./gradlew clean from terminal as well, but that didn't help.

I have also increased the Shared build process heap size from 1400 to 4000 Mbytes in IntelliJ -> Preferences -> Build, Execution, Deployment -> Compiler. That didn't help either.

I have tried with going through IntelliJ's Repair IDE steps, but that gave me the same errors when I was trying to rebuild project.

I am running out of ideas, how can I solve this issue and why has it all of a sudden appeared?

3 Answers

Change from

 -Dkotlin.daemon.jvm.options="-Xmx1g -Xshare:off" 

to

-Dkotlin.daemon.jvm.options="-Xmx1g"

JVM doesnt know what is Xshare

Maybe all the Remote Git Repo demean project is the only problem! I mentioned the daemon in my email and phone that was keeping me from responding to my messages and was kicking my emails to drafts! I am not sure what Git Repo is exactly but maybe you are taking to much!

Related