构建Cordova PhoneGap时出现VM错误

Gan*_*mar 17 eclipse android cordova phonegap-build

当我尝试创建Cordova PhoneGap应用程序时,我收到此错误,并在最后一步使用build命令

cordova build android
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误:

在此输入图像描述

错误

    
D:\rmapp>cordova run android
Running command: D:\rmapp\platforms\android\cordova\run.bat
ANDROID_HOME=D:\Android\sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_71
WARNING : No target specified, deploying to device '192.168.56.100:5555'.
Running: D:\rmapp\platforms\android\gradlew cdvBuildDebug -b D:\rmapp\platform
s\android\build.gradle -PcdvBuildArch=x86 -Dorg.gradle.daemon=true

FAILURE: Build failed with an exception.

* What went wrong:
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 http://gradle.org/docs/2
.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

D:\rmapp\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "D:\rmapp\platforms\android\grad
lew cdvBuildDebug -b D:\rmapp\platforms\android\build.gradle -PcdvBuildArch=x86
 -Dorg.gradle.daemon=true"
ERROR running one or more of the platforms: Error: D:\rmapp\platforms\android\c
ordova\run.bat: Command failed with exit code 1
You may not have the required environment or OS to run this project

Cha*_*ang 19

您的系统无法为jvm提供足够的连续内存空间并导致问题.

这对我有用:

添加GRADLE_OPTS值为的环境变量-Dorg.gradle.jvmargs=-Xmx512m

您可以使用-Xmx1g,如果您有更多的可用内存空间.

  • 1)打开系统属性2)转到高级系统设置3)单击环境变量按钮,4)添加具有上述设置的新系统变量.最诚挚的问候,Sarim Ghani http://www.i-splendid.com/ (4认同)

gat*_*sbr 8

Close Visual Studio - 至少这是我的问题.

和/或任何其他内存密集型程序.


hva*_*an3 5

JAVA_HOME默认为 x86 版本。JAVA_HOME在 System env 变量中添加一个新变量并将其指向 x64 版本对我有用。这是我最终选择的路径:

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


use*_*058 1

我在 Cordova 上工作时遇到了同样的问题。

正如这篇文章中提到的,看起来堆没有分配,因此 JVM 没有初始化。

尝试释放系统缓存,然后尝试构建项目。