2015-04-03 74 views
0

我試圖建立使用inonic build android一個Android應用程序,但我有以下錯誤:離子:不能建立Android應用

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) 

我已經安裝了Apache Ant的,但仍然是錯誤。我刪除了Android平臺ionic platform remove android並添加了ionic platform add android沒有成功。

有什麼想法?

UPDATE 我已經安裝了Android Studio和Android SDK工具。

回答

1

由於錯誤提示,你的系統需要安裝「機器人-21」,這就是Android 5.0棒棒糖

+0

我檢查了Android SDK管理器和下列項目安裝**的Android 5.0.1 ** :SDK平臺,Google API,Android SDK來源。 – bodruk 2015-04-03 17:07:56

+2

你錯過的東西是,在環境變量PATH中,添加這兩個項目1. path-to-android-sdk-***/tools 2. path-to-android-sdk-***/platform-tools。如果有效,請更新我。 – Bigman 2015-04-03 20:14:20

+0

不知道發生了什麼事。我剛剛重寫了'Path'中的'ant/bin'文件夾,它工作正常。 – bodruk 2015-04-07 18:57:04