2

I'm building a hybrid app using ionic framework. I did installed npm,cordova, ionic and android sdk. also I have set the environment variables. I was able to run following commands

  1. ionic start todo blank
  2. cd todo
  3. ionic platform add android

but when I run ionic build android The build fails.

BUILD FAILED

Total time: 29.551 secs FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'android'.

    java.lang.NullPointerException (no error message)

  • 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: A problem occurred configuring root project 'android'.

    java.lang.NullPointerException (no error message)

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ajay Gupta
  • 21
  • 1
  • 5

3 Answers3

0

I have faced the same issue and Solved... What you need to do is

  • first Solution

    • ionic platform rm android ,

    • ionic platform add android ,

If that does not work then

  • Second

    • Remove your all plugins and add again ,

Solved my problem

Gopinath Kaliappan
  • 6,929
  • 8
  • 37
  • 60
  • Now I m not getting the previous error message.But the command prompt throws another kind of error. Found corrupted package.xml at C:\Users\mindshare-11\android-sdks\build-tools\24.0.1\package.xml BUILD FAILED Total time: 53.678 secs FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android'. > java.lang.NullPointerException (no error message) – Ajay Gupta Jul 29 '16 at 11:14
  • Did u install ionic 2 in your machine – Gopinath Kaliappan Jul 30 '16 at 12:47
  • No !! i have not installed ionic 2 – Ajay Gupta Jul 30 '16 at 13:13
  • Issue resolved..!!! i just set the environment variable(ANDROID_HOME & PATH) in the CLI. – Ajay Gupta Jul 31 '16 at 11:07
0

This worked for me.Just needed to set the environment variable(ANDROID_HOME & PATH) in the CLI

Ajay Gupta
  • 21
  • 1
  • 5
0

Just remove the node_modules folder from your project using:

rm -rf node_modules

and then install all dependencies again:

npm i