Ionic build android problem please help

When I ran the following command:

ionic build android

in the command prompt on my Windows 7 machine I get the following errors pop up:

BUILD FAILED
C:\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:542: Unable to resolve project target ‘android-21’

Total time: 1 second

C:\Users<user name>\Hello_Android\platforms\android\cordova\node_modules\q\q.js:126

throw e;

Error code 1 for command: cmd with args: /s /c “ant-debug -f “C:\Users<user name>\Hello_Android\platforms\android\build.xml” -Dout.dir=ant-build -Dgen.absolute.dir=ant-gen”

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 the project

Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone <C:\Users<user name>\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:1015:16>
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Could anybody help me please with this problem?

Install android sdk api 21 maybe you have only 19

I have got Android SDK API 21 installed on my system and it is still giving these error messages. I think it has something to do with my Apache Ant installation. The reason why I come to this conclusion is because when I type the ant command into the command line it comes up with Buildfile: build.xml does not exist! Build failed error. Has this got something to do with it?

how version of node you use? if 0.12.X you need reinstall cordova complete

$ sudo npm -glf install cordova

The cordova version that I have got is 4.3.0. I don’t think it has anything to do with the cordova because when I add a platform to my project it works fine. It’s just when I run the ionic build android command it’s giving me the errors.

The cordova version that I have got is 4.3.0. I don’t think it has anything to do with the cordova because when I add a platform to my project it works fine. It’s just when I run the ionic build android command it’s giving me the errors.

I am also facing similar issue. I have sdk 21 installed on my system.

BUILD FAILED
E:\adt-bundle-windows-x86-20131030\sdk\tools\ant\build.xml:601: The following error occurred while executing this line:
E:\adt-bundle-windows-x86-20131030\sdk\tools\ant\build.xml:542: Unable to resolve project target ‘android-21’

Total time: 6 seconds

C:\Users\ranveer\myApp\platforms\android\cordova\node_modules\q\q.js:12

Any ideas or pointers to resolve this issue.

Thanks