2

I'm new to phonegap & cordova, I have created phonegap project, however when I try to build the project using the command "cordova build" I get the below error message:

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)

I have tried the options below:

  1. Android, java, ant is set properly in the path & java,android & ant command can be executed from the command line
  2. tried closing all the running applications on my machine but still could not resolve the issue (My machine is intel i7 processor with 8GB RAM).
Dan Ross
  • 3,596
  • 4
  • 31
  • 60
Abhijit Patil
  • 31
  • 1
  • 3
  • The jvm instance for Gradle isn't getting started because there isn't enough memory available. Are you running 64bit java? Check with `java -version` Some answers here: http://stackoverflow.com/questions/26143740/getting-gradle-error-could-not-reserve-enough-space-for-object-heap-constantly – laughingpine Jun 29 '15 at 21:40
  • 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, mixed mode, sharing) – Abhijit Patil Jun 30 '15 at 06:09

2 Answers2

1

Initially I had set JAVA_HOME to JDK1.6 I installed JDK1.7 & updated the JAVA_HOME accordingly & the issue was resolved.

Thanks.

Abhijit Patil
  • 31
  • 1
  • 3
1

You can also try- check which version of jdk you are using, use 64bit jdk version for 64bit machine, if you were using 32bit jdk previously by mistake.

I was getting same error for 32bit JDK and solved by using 64-bit jdk.

Kunal
  • 21
  • 3