0

When I'm trying to import a gradle project to eclipse IDE I'm getting this error:

I don't know why it's getting me errors like:

Error: Could not create the Java Virtual Machine.

Error: Invalid maximum heap size: -Xmx4g

I've never specified options like -Xmx4g. I don't know where are they got from?

Synchronize Gradle projects with workspace failed due to an error connecting 
to the Gradle build.
Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.3.1-bin.zip'.

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 guide chapter on the daemon at https://docs.gradle.org/4.3.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=4g; support was removed in 8.0
Invalid maximum heap size: -Xmx4g
The specified size exceeds the maximum representable size.
Community
  • 1
  • 1
Jordi
  • 20,868
  • 39
  • 149
  • 333

2 Answers2

2

It seems like a Gradle Daemon issue.

You can configure it by including the following line into your gradle.properties:

org.gradle.jvmargs=-Xmx512m

Let me know how it goes.

chenrui
  • 8,910
  • 3
  • 33
  • 43
1

The problem seems to be Invalid maximum heap size: -Xmx4g .

Check this answer for more on max size to be set Maximum Java heap size of a 32-bit JVM on a 64-bit OS

gladiator
  • 1,249
  • 8
  • 23
  • I'm willing to remove this option. In fact, I don't know why it's picked up, I don't remember to have set this option anywhere. Any ideas about how to remove it? – Jordi Nov 21 '17 at 09:04
  • in eclipse check run configuration or check your gradle properties file somewhere 4g is mentioned if not add vm arg -Xmx to some value you need – gladiator Nov 22 '17 at 05:52