【问题标题】:cordova Error occurred during initialization of VM初始化VM期间发生cordova错误
【发布时间】:2015-09-16 11:36:47
【问题描述】:

我是 phonegap 和 cordova 的新手,我创建了 phonegap 项目,但是当我尝试使用命令“cordova build”构建项目时,我收到以下错误消息:

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
Could not create the Java virtual machine.


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

G:\HelloApp\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c ""G:\HelloApp\platforms\android\gradlew" cdvBuildDe
bug -b "G:\HelloApp\platforms\android\build.gradle" -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1

You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
    at ChildProcess.whenDone (C:\Users\Admin\AppData\Roaming\npm\node_modules\
cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1008:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1080:5)

我已经尝试了以下选项:

  1. android,java,ant在路径&java,android&ant命令中设置正确,可以从命令行执行
  2. 尝试关闭我机器上所有正在运行的应用程序,但仍然无法解决问题(我的机器是带有 8GB RAM 的 intel i7 处理器)。

【问题讨论】:

  • Gradle 的 jvm 实例没有启动,因为没有足够的可用内存。你在运行64位java吗?检查java -version 这里的一些答案:stackoverflow.com/questions/26143740/…
  • C:\Users\Admin>java -version java version "1.6.0_13" Java(TM) SE Runtime Environment (build 1.6.0_13-b03) Java HotSpot(TM) Client VM (build 11.3 -b02,混合模式,共享)

标签: android cordova jvm phonegap-plugins heap-memory


【解决方案1】:

最初我将 JAVA_HOME 设置为 JDK1.6,我安装了 JDK1.7 并相应地更新了 JAVA_HOME,问题得到解决。

谢谢。

【讨论】:

    【解决方案2】:

    您也可以尝试检查您使用的是哪个版本的 jdk,如果您之前错误地使用了 32 位 jdk,则使用 64 位 jdk 版本用于 64 位机器。

    我在 32 位 JDK 上遇到同样的错误,并通过使用 64 位 jdk 解决。

    【讨论】:

      猜你喜欢
      • 2017-03-31
      • 2018-11-12
      • 1970-01-01
      • 2011-09-24
      • 2015-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多