我在 Ubuntu 上安装了 cordova、cordova cli、android studio 和所有软件包,但是当我尝试构建我的应用程序时,我收到以下错误:
Running command: /home/admin/Desktop/hello/platforms/android/cordova/build
[Error: Please install Android target: "android-21".
Hint: Open the SDK manager by running: /opt/android-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: /home/admin/Desktop/hello/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/admin/Desktop/hello/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.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
注意:我在bashrc中添加了android-sdk的路径:
#AndroidDev PATH
export PATH=${PATH}:${HOME}/android-sdk-linux/tools
export PATH=${PATH}:${HOME}/android-sdk-linux/platform-tools
最佳答案
这个问题你说对了!! https://stackoverflow.com/questions/29062330/error-install-android-target-cordova-cli
更新您的 SDK 工具
和 Android SDK 中的“SDK 构建”工具。使用 Eclipse ADT,它看起来像这个图像
安装 21 软件包,因为您的 cordova 版本需要软件包 21
关于android - Cordova 构建需要 SDK 平台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29181712/