简体   繁体   中英

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.

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)

在此处输入图片说明

As you can see the latest sdk platform version ie 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM