Cordova 请安装 Android 目标 19
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20677999/
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
Cordova Please Install Android target 19
提问by Debopam Mitra
I am using Cordova-3.3.0, and when trying to create a project for Android I am getting this following error -
我正在使用 Cordova-3.3.0,并且在尝试为 Android 创建项目时出现以下错误 -
Error: Please install Android target 19 (the Android newest SDK).
错误:请安装 Android 目标 19(Android 最新的 SDK)。
I have the latest android installed along with the Android 18 and 17. And even if I use Cordova-3.2.0 I get the same result
我安装了最新的 Android 以及 Android 18 和 17。即使我使用 Cordova-3.2.0,我也会得到相同的结果
Android target 18 not found
未找到 Android 目标 18
.
.
Please can anyone suggest what might be the problem?
请任何人都可以建议可能是什么问题?
I am using the following along with cordova - ant version 1.9.2 java 1.7.0_45
我正在使用以下和cordova - ant version 1.9.2 java 1.7.0_45
采纳答案by jusabatier
Have you correctly set android SDK tools in your Path ?
您是否在 Path 中正确设置了 android SDK 工具?
For Cordova command-line tools to work, you need to include the SDK's tools and platform-tools directories in your PATH environment. On Mac, you can use a text editor to create or modify the ~/.bash_profile file, adding a line such as the following, depending on where the SDK installs:
要使 Cordova 命令行工具正常工作,您需要在 PATH 环境中包含 SDK 的工具和平台工具目录。在 Mac 上,您可以使用文本编辑器创建或修改 ~/.bash_profile 文件,添加如下一行,具体取决于 SDK 的安装位置:
You have to install the SDK and include tools and platform-tools directories to your path, after you need to install correct versions of Android (19 in your case).
在您需要安装正确版本的 Android(在您的情况下为 19)之后,您必须安装 SDK 并将 tools 和 platform-tools 目录包含到您的路径中。
回答by Murphy
- Launches " SDK Manger" with administrator rights
- Install Android 4.4.2 (API 19)
- and retry command-line : cordova platforms add android
- 推出具有管理员权限的“SDK Manger”
- 安装 Android 4.4.2 (API 19)
- 并重试命令行:cordova 平台添加 android
回答by nijin
For Windows, in the Environment Variable try place the java\bin directory before the windows\system32 directory.
对于 Windows,在环境变量中尝试将 java\bin 目录放在 windows\system32 目录之前。
This makes the SDK Manager to use java from java\bin directory else it would use java found in the system32 folder.
这使得 SDK 管理器使用 java\bin 目录中的 java,否则它将使用在 system32 文件夹中找到的 java。
回答by Zakher Masri
I faced the same problem and the way I solved it is by lunching SDK Manager through the command prompt
我遇到了同样的问题,我解决的方法是通过命令提示符午餐 SDK Manager
The error looked like:
错误看起来像:
Error: Please install Android target "android-19".
Hunt: Run "android" from your command-line to open the SDK manager.
I simply opened the SDK manager, scrolled down, and downloaded the "Android 4.4.2 (API 19)" as a package and the problem was solved.
我只是打开SDK管理器,向下滚动,然后将“Android 4.4.2 (API 19)”作为包下载,问题就解决了。
回答by Dan
I've just had the same issue, even though I had set the path environment variable for the OS. It turned out to be because I was using Powershell. It worked after I added the following to my profile.ps1:
我刚刚遇到了同样的问题,即使我已经为操作系统设置了路径环境变量。原来是因为我用的是Powershell。在我将以下内容添加到我的 profile.ps1 后,它起作用了:
$env:Path += ";C:\Users\Dan\AppData\Local\Android\sdk\android-sdk\tools"
$env:Path += ";C:\Users\Dan\AppData\Local\Android\sdk\android-sdk\platform-tools"
Typically, the profile.ps1 path will be here:
通常,profile.ps1 路径将在此处:
C:\Users\<username>\Documents\WindowsPowerShell\profile.ps1
To be honest, I'm not quite sure why it didn't work when I added them via the Windows GUI (ie. Advanced System Settings -> Environment variables). So perhaps it's a configuration issue on my part - eitherway, adding it to my profile.ps1 fixed it - so I thought I'd add it hear incase it helps anyone else.
老实说,当我通过 Windows GUI(即高级系统设置 -> 环境变量)添加它们时,我不太确定为什么它不起作用。所以也许这是我的配置问题 - 不管怎样,将它添加到我的 profile.ps1 修复了它 - 所以我想我会添加它,以防它帮助其他人。
回答by mrmendez
If you are using Windows, just go to the environment variablesin system and look the System's variable and add both:
如果您使用的是 Windows,只需转到system 中的环境变量并查看 System 的变量并添加两者:
C:\proyectos\adt-bundle-windows-x86_64-20131030\sdk\tools\;
C:\proyectos\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\
C:\proyectos\adt-bundle-windows-x86_64-20131030\sdk\tools\;
C:\proyectos\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\
?live long and prosper!
?健康长寿·繁荣昌盛!
回答by Nahuel Barrios
I had the same problem, and in my case I was setting the
我遇到了同样的问题,就我而言,我正在设置
sdk.dir
property to an invalid location.
属性到无效位置。
Search that property in the whole project and check its value. In my case it was in local.properties, but take a look to project.properties, and ant.propertiesbecause they all are loaded in Android's build.xmlfile.
在整个项目中搜索该属性并检查其值。就我而言,它在local.properties 中,但请查看project.properties和ant.properties ,因为它们都加载在 Android 的build.xml文件中。
Hope it helps!
希望能帮助到你!