Cordova Please Install Android target 19

2019-01-28 02:33发布

问题:

I am using Cordova-3.3.0, and when trying to create a project for Android I am getting this following error -

Error: Please install Android target 19 (the Android newest 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 target 18 not found

.

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

回答1:

Have you correctly set android SDK tools in your Path ?

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:

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).



回答2:

  • Launches " SDK Manger" with administrator rights
  • Install Android 4.4.2 (API 19)
  • and retry command-line : cordova platforms add android


回答3:

For Windows, in the Environment Variable try place the java\bin directory before the windows\system32 directory.

This makes the SDK Manager to use java from java\bin directory else it would use java found in the system32 folder.



回答4:

I faced the same problem and the way I solved it is by lunching SDK Manager through the command prompt

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.



回答5:

If you are using Windows, just go to the environment variables in system and look the System's variable and add both:

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!



回答6:

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.properties because they all are loaded in Android's build.xml file.

Hope it helps!



回答7:

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:

$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:

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.