Gradle error to download when execute ionic build android

I am try to compile an new project using command ionic build android, but i get this error:

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


add to body class: platform-android

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

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_101

Subproject Path: CordovaLib



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 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 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 2097152KB object heap


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

###System info

C:\Users\pedromiguel\aplicacionesIonic\sqliteTest>ionic info

Your system information:

 ordova CLI: 6.4.0
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v5.5.0
Xcode version: Not installed

@PterPmnta This is what you have to do goto your local disc C, then click user, then click/open your system profile name then click/open a folder named as .gradle then click/open “wrapper folder” , then open dists folder". Then delete all folders inside the dists folder after that go to your command line interface and build your project again. Please make sure you are connected to the internet when doing this build. Let me know the outcome Cheeeers!!!

1 Like

I try tomorrow, thanks for your answer

Hey, Does it worked?

Not work for me, but i do it that,

Add new enviroment variable

Variable: _JAVA_OPTIONS

Value: -Xmx512M
2 Likes

Hey @PterPmnta. Does your solution really work? if yes, after creating the environment variable, what next to do to make the build work? thanks to answer