Cordova 3.5.0 安装错误 - 请安装 Android Target 19

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24931155/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:55:38  来源:igfitidea点击:

Cordova 3.5.0 Install Error- Please Install Android Target 19

androidmacoscordova

提问by clankill3r

I try to get this working and it's driving me nuts:

我试着让它工作,它让我发疯:

$ cordova platform add android

The output is:

输出是:

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)

If did run the command androidthis are all the things I installed:

如果确实运行了命令,android这就是我安装的所有东西:

installed

已安装

I also did:

我也做了:

open ~/.bash_profile

open ~/.bash_profile

And added:

并补充说:

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

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

But it doesn't help :(

但这没有帮助:(

Could someone help.

有人可以帮忙。

回答by Deb

Android SDK is not your target Android version. Target Android version 19 is the API level for android Kitkat.So in you SDK manager check if you have Android 4.4.2(API 19) installed. If you want your target API version to be different then change it in ANdroidManifest.xml

Android SDK 不是您的目标 Android 版本。目标 Android 版本 19 是 android Kitkat 的 API 级别。所以在您的 SDK 管理器中检查您是否安装了 Android 4.4.2(API 19)。如果您希望目标 API 版本不同,请在 ANdroidManifest.xml 中更改它

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

Edit these lines. Here android:targetSdkVersionis your Android version that you are targeting.

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

enter image description here

在此处输入图片说明

回答by maudulus

1) Went into the SDK Manager (typing androidinto the terminal, assuming it's in your file path)

1)进入SDK Manager(输入android终端,假设它在你的文件路径中)

2) Selected box next to Android 4.4.2 (API 19)

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

3) Clicked button Install 8 packages

3)点击按钮 Install 8 packages

4) Ran original command (in this example cordova platform add android, although it could be ionic platform add android, depending on what you're working with)

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

回答by Paul Cochrane

I too was getting the same error 19. I have no idea about AndroidManifest.xml and where it is supposed to be.

我也遇到了同样的错误 19。我不知道 AndroidManifest.xml 以及它应该在哪里。

In my case, I fixed the error by running the 'android' command from the console, opening the Android 4.4.2 (API19) tree and installing the SDK Platform.

就我而言,我通过从控制台运行“android”命令、打开 Android 4.4.2 (API19) 树并安装 SDK 平台来修复错误。

After this was installed the cordova platform add androidcommand worked as desired.

安装后,cordova 平台 add android命令按需要工作。

Further to this I had to install a few other elements of API19 to be able to create an android emulator:

除此之外,我必须安装 API19 的其他一些元素才能创建一个 android 模拟器:

  • ARM EABI v7a System Image
  • Intel x86 Atom System Image
  • Google APIs (x86 System Image)
  • Google APIs (ARM System Image)
  • ARM EABI v7a 系统映像
  • Intel x86 Atom 系统映像
  • Google API(x86 系统映像)
  • Google API(ARM 系统映像)

I could then create an emulator based on API19 using the Android Virtual Device (AVD) Manager that is included in the android SDK bundle.

然后,我可以使用包含在 android SDK 包中的 Android 虚拟设备 (AVD) 管理器创建基于 API19 的模拟器。

回答by Jan Tch?rm?n

I also had to change project.properties in the same directory

我还必须在同一目录中更改 project.properties

target=android-19
android.library.reference.1=CordovaLib

回答by PodTech.io

If your having issues installing the package, ensure you are running 'Android Central' as an administrator... took me 30 mins to work it out!!

如果您在安装软件包时遇到问题,请确保您以管理员身份运行“Android Central”……我花了 30 分钟来解决这个问题!

回答by dykstrad

Here is documentation on how you set up an AndroidManifest.xml document. Every app should have one.

这是有关如何设置 AndroidManifest.xml 文档的文档。每个应用程序都应该有一个。

http://developer.android.com/guide/topics/manifest/manifest-intro.html

http://developer.android.com/guide/topics/manifest/manifest-intro.html