简体   繁体   中英

Ionic: can't build Android app

I'm trying to build an Android app using inonic build android but I have the following error:

running cordova build android
Running command: "c:\Program Files\nodejs\node.exe" c:\xampp\htdocs\discipulado\
discipulado\hooks\after_prepare\010_add_platform_class.js c:/xampp/htdocs/discip
ulado/discipulado
add to body class: platform-android
Running command: c:\xampp\htdocs\discipulado\discipulado\platforms\android\cordo
va\build.bat
[Error: Please install Android target: "android-21".

Hint: Open the SDK manager by running: C:\Users\Thiago\AppData\Local\Android\sdk
\tools\android.BAT
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: c:\xampp\htdocs\discipulado\discipul
ado\platforms\android\cordova\build.bat: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: c:\xampp\htdocs\discipulado\discipulado\platforms\android\cordova\build.b
at: Command failed with exit code 2
    at ChildProcess.whenDone (c:\Users\Thiago\AppData\Roaming\npm\node_modules\c
ordova\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)

I already installed Apache Ant, but the error remains. I removed the Android platform with ionic platform remove android and added with ionic platform add android with no success.

Any idea?

UPDATE I already installed Android Studio and Android SDK Tools.

如错误所示,您的系统需要安装“ android-21”,即Android 5.0 Lollipop

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM