Build failed with an exception

hey guys how do you fix this issue?i have tried to remove the .gradle folder…but no luck…

Microsoft Windows [Version 10.0.10586]
© 2015 Microsoft Corporation. All rights reserved.

C:\Users\mike>ionic build android
Error happened { [Error: ENOENT: no such file or directory, open ‘C:\Users\mike\config.xml’]
errno: -4058,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘C:\Users\mike\config.xml’ }
Error: ENOENT: no such file or directory, open 'C:\Users\mike\config.xml’
at Error (native)

C:\Users\mike>$ cd testapp
’$’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\mike>cd testapp

C:\Users\mike\testapp>ionic build android
Running command: “C:\Program Files (x86)\nodejs\node.exe” C:\Users\mike\testapp\hooks\after_prepare\010_add_platform_class.js C:\Users\mike\testapp
add to body class: platform-android
Running command: cmd "/s /c “C:\Users\mike\testapp\platforms\android\cordova\build.bat”"
ANDROID_HOME=C:\Users\mike\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_55
Running: C:\Users\mike\testapp\platforms\android\gradlew cdvBuildDebug -b C:\Users\mike\testapp\platforms\android\build.gradle -Dorg.gradle.daemon=true
Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip

Unzipping C:\Users\mike.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oiejfej094b\gradle-2.2.1-all.zip to C:\Users\mike.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oiejfej094b

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
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

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

C:\Users\mike\testapp\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "C:\Users\mike\testapp\platforms\android\gradlew cdvBuildDebug -b C:\Users\mike\testapp\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

C:\Users\mike\testapp>./gradlew clean
’.’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\mike\testapp>gradlew clean
’gradlew’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\mike\testapp>

Hi,

I had this happening when i moved my project from my mac to my pc.
It turned out I had an older version of the android sdk and also had mess in my PATH.

How I solved it:
I installed the latest sdk manager (not android studio) http://developer.android.com/sdk/index.html#Other
in sdk manager (run as admin) I installed:

in tools:

  • Android SDK tools
  • " " platform-tools
  • " " build tools

API23

in extras:

  • Android support repository
  • Android support library
  • Google USB driver

Then I Checked my path ( http://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10 )

long and behold… It worked.
The biggest insight for me was that the android API you need for deployment is irrelevant to the API the SDK needs to function (v23+)

Using this tutorial got me a long way:

Hope it helps…