Taha
Taha

Reputation: 1242

"Cordova run android" throws missing target error, even when dependencies are installed

I tried to run this command on command prompt

cordova run android --device

but I'm getting this error

Error: Please install Android target: "android-23".

Hint: Open the SDK manager by running: "C:\Users\taha\AppData\Local\Android\sdk\
tools\android.bat"
You will require:
1. "SDK Platform" for android-23
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)

when I open Android SDK Manager all these are installed

 Take a look here

I tried the solution in this question : Cordova 4.3.0 Error: Please install Android target: "android-21" but it doesn't work

how can I solve this problem ?

Upvotes: 0

Views: 144

Answers (4)

Taha
Taha

Reputation: 1242

Thanks for your help guys :

I solved my problem by deleting all files in

C:\Users\taha\AppData\Local\Android\sdk

and I put under this location all files from

C:\Users\taha\AppData\Local\android-sdk

Upvotes: 0

Philip Bijker
Philip Bijker

Reputation: 5115

The SDK's you're looking at are not the SDK's you're building with.

The error message states opening the SDK's at C:\Users\taha\AppData\Local\Android\sdk\, while the screenshot displays the SDK's at C:\Users\taha\AppData\Local\android-sdk\

Option 1: Make sure you open the correct SDK manager (indicated by the error message) and add the required dependencies.

Option 2: You could also change the SDK's used by Cordova by updating the ANDROID_HOME environment variable from C:\Users\taha\AppData\Local\Android\sdk\ to C:\Users\taha\AppData\Local\android-sdk\

Upvotes: 2

Surya Krishy
Surya Krishy

Reputation: 170

Change the environment variable..

right click mycomputer -> properties -> advanced system settings -> click on advanced tab -> click on environment variables (at the bottom) -> select path and click edit. -> under variable add "C:\Users\taha\AppData\Local\android-sdk\" and click ok.

It will work . else post screen shot of the environment variables

Upvotes: 1

user5524279
user5524279

Reputation:

You need to create a virtual device first. After the creaton you can use the command. Looks like you just need to add the device because all required SDKs etc are installed.

Description: https://developer.android.com/studio/run/managing-avds.html

Upvotes: 0

Related Questions