MrPOC
MrPOC

Reputation: 33

cordova add platforms android command failed

I get a really strange problem when I type cordova platforms add android After I've pressed [Enter], I get the following error:

[Error: The command 'android' failed. Make sure you have the latest Android SDK installed, and the 'android' command (inside the tools/ folder) added to your path. Output: ]

But, I've correctly setup my PATH and the proof of that is that when I type android command or java or ant or adb, it's working but not for Cordova apparently.

Could you please help me? Thanks a lot.

Upvotes: 1

Views: 3564

Answers (2)

Pradyumna Swain
Pradyumna Swain

Reputation: 1138

Check your project.properties and AndroidManifest file for the API level of Android SDK against your installed Android SDK.

Steps:

  • Find your android sdk details in source.properties file({android sdk}/platforms/Android-x.x/). Basically find the AndroidVersion.ApiLevel
  • Edit your project.propereties file({Project_name}/platforms/android/) and change target=android-xx acoording to AndroidVersion.ApiLevel
  • Edit your AndroidManifest file ({Project_name}/platforms/android/) and change android:targetSdkVersion="xx" accordingly.

Hopefully it will work.

Upvotes: 0

Amit Gupta
Amit Gupta

Reputation: 8939

I also came across the same problem while adding android platform for cordova through command prompt.

It is very simple open Android SDK Manager

and install the latest version on Android SDK platform(4.2.2)

enter image description here

As you can see the latest sdk platform version i.e 4.2.2 is installed. So do the same and should solve your problem.

Now try again to run the command to add platform android for cordova.

add platform android

Hope this will help you.

Upvotes: 2

Related Questions