7

I have updated cordova to 7.0.1 in windows 8.1 After creating project when i add platform using this command

cordova platform add android

It gives me following error

 Using this version of Cordova with older version of cordova-android is deprecated. Upgrade to cordova-android@5.0.0 or newer.
 Error: Your android platform does not have Api.js

I tried to search it on forums but didn't get it resolved.

Divyesh Savaliya
  • 2,692
  • 2
  • 18
  • 37

4 Answers4

12

I think you have cordova-android version older than 5. Try to force cordova update:

npm install -g cordova@7.0.0

then try to readd cordova-android:

cordova platform rm android
cordova platform add android
Frix33
  • 1,231
  • 10
  • 27
  • I tried that but didn't work. I downgrade my Cordova. but that is not solution – Divyesh Savaliya May 27 '17 at 08:09
  • Try to launch "cordova platform version android" and "cordova --version" command from root of your project. What version of cordova-android is displayed? – Frix33 May 29 '17 at 08:01
4

run

$ sudo npm uninstall cordova -g

and

$ sudo npm install -g cordova@6.0.0

I did not get another solution

  • 1
    It was working while I have an older version of Cordova, but the error comes after upgrading Cordova to 7. A downgrade is not a solution of my question. – Divyesh Savaliya May 27 '17 at 08:10
  • [don't use `sudo` with `npm`](https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92) – OJ7 Oct 31 '19 at 15:35
4

Run this at your terminal

ionic cordova platform rm .idea
vofili
  • 91
  • 8
0

Simply just

cordova platform rm android
cordova platform add android
Kuldeep Kumar
  • 754
  • 1
  • 7
  • 12