我刚刚在我的应用程序中更新了cordova + ionic,之后通过Android SDK管理器成功安装了Android-SDK v22。
但是在运行命令之后:
cordova build android
我总是收到以下消息:
Running command: /Users/peter/workspace/myapp/platforms/android/cordova/build
[Error: Please install Android target: "android-21".
Hint: Open the SDK manager by running: /Users/peter/adt-bundle-mac/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/peter/workspace/myapp/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/peter/workspace/myapp/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:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
我也尝试过
cordova platform rm android
cordova platform add android
但结果相同:
我试图找到几个小时的任何可行的解决方案,但是很幸运。
感谢您的任何建议。
系统信息:
OS: Mac OS X Yosemite
Node Version: v0.12.0
Cordova CLI: 4.3.0
Ionic Version: 0.9.27
Ionic CLI Version: 1.3.18
Xcode version: Xcode 6.2 Build version 6C131e
ios-sim version: 3.1.1
ios-deploy version: 1.4.0
最佳答案
我只是有同样的问题。
我必须更改目标:
# Project target.
target=android-22
这应该在两个文件中完成:
myApp / platforms / android / project.properties
myApp / platforms / android / CordovaLib / project.properties
list 也应更新:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />