Ionic Build Error

Hi Friends,

I am new ionic framework. I have worked some sample app and try to build in android for learning. But i cant but to build successfully in android. i have received following error i have checked the environment variables my current environment variable is :smile:

C:\Program Files\Java\jdk1.8.0_60;
C:\Program Files\apache-ant-1.9.6

Error is :

Hint: Open the SDK manager by running: C:\Users\ranjeet\AppData\Local\Android\an
You will require:
1. "SDK Platform" for android-22
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
ERROR building one of the platforms: Error: cmd: Command failed with exit code 2

You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 2
    at ChildProcess.whenDone (C:\Users\ranjeet\AppData\Roaming\npm\node_modules\
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:817:16)
    at Process.ChildProcess._handle.zonexit (internal/child_process.js:211:5)

My ionic info is :

Cordova CLI: 5.3.3
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.0
Ionic Version: 1.1.0
Ionic CLI Version: 1.4.8
Ionic App Lib Version: 0.0.23
OS: Windows 8.1
Node Version: v4.1.1

Can anybody please help me on this. Thanks.

I had the same issue. Run the “android” command (the path is in the error you posted). Make sure you’ve selected the “Android SDK Platform-tools”, “Android SDK Build-tools” (the most recent should be ok) and, in your case, “Android 5.1.1 (API 22)” as it indicates. The default SDK does not download these for you before you run the “android” command.

You’ll want to get in the habit of periodically running the android command to keep your Andrdoid SDK up to date.

Thanks It is working fine after update a android SDK.