FAILURE:构建失败,出现异常。离子

Onu*_*der 1 cmd ionic-framework

我正在尝试构建一个 IONIC 项目,但我面临这个异常,我无法为此调试解决方案。我尝试了很多建议,但没有解决方案。我正在等待您的帮助

    1-ionic start test4 tabs
    2-cd test4
    3-ionic platform add android
    4-ionic build android
Run Code Online (Sandbox Code Playgroud)

错误

       C:\Users\onurr\test4>ionic build android
       Running command: "C:\Program Files\nodejs\node.exe"  
       C:\Users\onurr\test4\hooks\after_prepare\010_add_platform_class.js       
       C:\Users\onurr\test4   

        add to body class: platform-android

        ANDROID_HOME=C:\Users\onurr\AppData\Local\Android\sdk

        JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_112

        Subproject Path: CordovaLib

       Starting a new Gradle Daemon for this build (subsequent builds will be faster).



     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 https://docs.gradle.org/2.14.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 2097152KB object heap


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

   Error: cmd: Command failed with exit code 1 Error output:
   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 https://docs.gradle.org/2.14.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 2097152KB object heap


   * Try:
   Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Run Code Online (Sandbox Code Playgroud)

Pra*_*ire 5

我假设您正在使用 Windows 查看堆栈跟踪。

请注意堆栈跟踪中的此消息:

Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
Run Code Online (Sandbox Code Playgroud)

这通常发生在您拥有 32 位 JVM 时。如果您的操作系统是 64 位,请将 32 位 JVM 替换为 64 位 JVM。它具有更高的堆约束,将解决问题。这是推荐的解决方案。

阅读此oracle 文档以获取更多信息。

如果您的操作系统是 32 位,请尝试按以下方式设置您的操作系统并重新ionic build android发出命令(可能需要重新启动命令提示符):

转到StartControl PanelSystemAdvanced System SettingsAdvanced (tab)Environment VariablesSystem VariablesNew

Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Run Code Online (Sandbox Code Playgroud)