0
votes

I'm facing the below error when I'm trying to run cordova build android command on ionic framework v1. please help me

$ ionic cordova build android

ionic cordova prepare √ cordova prepare - done! Running command: "C:\Program Files\nodejs\node.exe" C:\mobileproject\DatasoftwareApp\hooks\after_prepare\010_add_platform_class.js C:\mobileproject\Data softwareApp add to body class: platform-android × cordova build android - failed! [ERROR] An error occurred while running cordova build android (exit code 1):

    Running command: "C:\Program Files\nodejs\node.exe" C:\mobileproject\Dat                         aRecoverysoftwareApp\hooks\after_prepare\010_add_platform_class.js C:\mobileproj                         ect\DataRecoverysoftwareApp
    add to body class: platform-android
    ANDROID_HOME=C:\Users\amit.joshi\AppData\Local\Android\sdk
    JAVA_HOME=C:\Program Files (x86)\java\jdk1.8.0_151
    Subproject Path: CordovaLib
    Starting a Gradle Daemon (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.gra                         dle.org/3.3/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.gra                         dle.org/3.3/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.
1

1 Answers

1
votes

Error occurred during initialization of VM

Could not reserve enough space for 2097152KB object heap

It looks like it can not allocate space. Are you by any chance using a 32bit java version? If yes, try 64bit.

Are you out of memory?