Error: Please install Android target “android-21”

Dear all,
am new to this platform and my question is how i can solve this error "Error: Please install Android target “android-21”"
I got such message when I type $ ionic build android
Please assist

@jadago In your CLI type $ android the sdk manager will open. Then install the android api level 21. Once done, rebuild the app.

Thanks for your help.I did manage to proceed

Why is android api 21 mandatory for building ionic ? Cant i built it on lower Api s?

I’m not sure if anyone else is experiencing the same problem as me, but I’ve installed all the android sdk platform tools and build tools and I’m still getting this error on a mac.

[Error: Please install Android target: "android-21".

Hint: Open the SDK manager by running: /Applications/adt/sdk/tools/android
You will require:
1. "SDK Platform" for android-21
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
ERROR building one of the platforms: Error:         /Users/Omoikane/documents/coding/ionic/bucket_vision/bv3/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error:     /Users/Omoikane/documents/coding/ionic/bucket_vision/bv3/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Process.ChildProcess._handle.onexit (child_process.js:822:5)

I’ve tried updating java, restarting my computer and re-installing the platform tools etc… still no effect, I think I’m missing something obvious.

Do you use eclipse adt bundle? If yes, you must change eclipse jre version in the eclipse preferences.

I’m trying to build the app directly from the terminal, but I’ll try update the eclipse jre version and see what happens. I thought I had setup all my path variables, but I’m starting to think I need to look at that again.

Thanks for your quick response!

We are also facing the same issue that Emile has described above. Emile, is it resolved after changing the JRE version?

I ended up using phonegap build for the android version, but I’m still keen to fix this, so far I’ve updated my java_home path variable and still no effect. If I make any progress I’ll post it here.

Ok, thanks Emile for the reply.

Do you have correct PATH also for Android platform-tools and tools folders?

C:\Program Files\Android\sdk\tools
C:\Program Files\Android\sdk\platform-tools

That’s just what came to my mind…

Yes, we have set those correctly.

i use sdk version 23
change the target:

Project target.

target=android-23
This should be done in two files:
myApp/platforms/android/project.properties
myApp/platforms/android/CordovaLib/project.properties
Also the manifest should be updated: