Cordova 3.5.0安装错误 - 请安装Android Target 19 这该如何解决?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (124)

我用的这样的:

$ cordova platform add android

输出是这样的:

Creating android project...

/Users/doekewartena/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:126
                    throw e;
                          ^
Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.
    at /Users/doekewartena/.cordova/lib/android/cordova/3.5.0/bin/lib/check_reqs.js:80:29
    at _fulfilled (/Users/doekewartena/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/Users/doekewartena/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/Users/doekewartena/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:760:13)
    at /Users/doekewartena/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:574:44
    at flush (/Users/doekewartena/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:419:13)
Error: /Users/doekewartena/.cordova/lib/android/cordova/3.5.0/bin/create: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135: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)

如果没有运行命令,android这是我安装的所有东西:

我也做了:

open ~/.bash_profile

并补充道如下:

export PATH=${PATH}:/Users/doekewartena/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools:/Users/doekewartena/Documents/adt-bundle-mac-x86_64-20140702/sdk/tools

提问于
用户回答回答于

如果你希望你的目标API版本不同,请在ANdroidManifest.xml中更改它:

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="18" />

编辑这些行。这android:targetSdkVersion是你的目标Android版本:

用户回答回答于

你可以执行下面4步步骤:

1)进入SDK管理器(键入android终端,假设它在您的文件路径中)

2)Android 4.4.2(API 19)旁边的选定框

3)点击按钮 Install 8 packages

4)运行原始命令(在这个例子中cordova platform add android,尽管它可能是ionic platform add android,取决于你正在使用的是什么)

扫码关注云+社区