VM error while Build Cordova PhoneGap

天大地大妈咪最大 提交于 2019-12-01 03:04:04

Your system can not provide enough continuous memory space for the jvm and causes the problem.

Here is what works for me:

Add an environment variable GRADLE_OPTS with the value of -Dorg.gradle.jvmargs=-Xmx512m

You can use -Xmx1g if you have more memory space available.

Close Visual Studio -- at least this was the problem in my case.

and/or any other memory intensive program.

My JAVA_HOME was defaulting to the x86 version. Adding a new JAVA_HOME variable in the System env variable and pointing it to the x64 version worked for me. This was the path I ended up with:

C:\Program Files\Java\jdk1.8.0_162

I had the same problem too. Try to run command line with administrative privileges.

just solved this problem in windows 8.1 and windows 7. Here is what I did:

  1. Uninstall everything that is java related in your Programs and Features in control panel
  2. check the following directory and delete the java folders: a. c:\users\\AppData\Local\Oracle b. c:\users\\AppData\LocalLow\Oracle c. c:\Program Files\Java d. C:\Program Files (x86)\Java e. C:\ProgramData\Oracle **IMPORTANT: only delete this folders after successfully uninstalling all java entries in control panel > Programs and Features
  3. Download and install the latest Java SDK from here
  4. After all you are done go to cmd(run as admin) and try to build again

conclusion: from what I understand, I do not have java properly configured/installed in my machine. so a clean install of everything is what solved my problem.

I got this error even if I used 2 gigs (-Dorg.gradle.jvmargs=-Xmx2048m), but it started to work when I changed JAVA_HOME to a 64-bit JDK directory. Using a higher version of Java might help also (1.8+).

user5470846

Change argument -Xmx20484m to 1024 at line:

args.push('-Dorg.gradle.jvmargs=-Xmx1024m'); 

in your project file

platforms\android\cordova\lib\builders\GradleBuilder.js

. It's work for me

https://forum.ionicframework.com/t/build-failed-unable-start-the-daemon-process/72171

It work for me in eclipce phonegap plugin

Piya Poonsawat

In Environment variables, add a system variable _JAVA_OPTIONS having the value -Xmx512M.

Run the following command in CLI with admin right.

>export _JAVA_OPTIONS="-Xmx256M"

This happens to me on machines with a lot of ram, but with lower memory ulimits. Java decides to allocate a big heap because it detects the ram in the machine, but it's not allowed to allocate it because of ulimits.

I had the same problem while I was working on Cordova.

As mentioned in this post, it looks like the heap is not allocated and so the JVM isn't initialized.

Try to free your system cache and then try building the project.

This error happens to me from time to time. I fix this by running the program "SDK Manager" in ANDROID_HOME folder.

I got this error because I didn't have a 32-bit JDK installed. Installed that, restarted and that fixed it.

My solution was to just install the new Java SDK. I also had to change my JAVA_HOME Path to point to that new SDK

I had had the same problem with my cordova project when I have installed the last version of JDK 1.8.0.121.

To solve the problem, I have uninstalled all my JDK versions (1.6, 1.7, 1.8..) and just installed the last version.

Install 64bit version of Java JDK and point JAVA_HOME to the install dictionary.

You need to allocate memory by setting two environment variables:

  • _JAVA_OPTIONS with value -Xmx2048M, to set up how much memory Java uses
  • GRADLE_OPTS with value -Dorg.gradle.jvmargs=-Xmx2048m, to set up how much memory Gradle uses (this can be specified by per project basis through [PROJECT PATH]\platforms\android\cordova\lib\builders\GradleBuilder.js path, although by default it's setup to be 2GB atm)

If cordova complains with Failed to run "javac -version" change the memory in _JAVA_OPTIONS for something lower.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!