Failed to fetch platform cordova-android@^8.0.0

6.1k views Asked by At

I am newbie to cordova i have installed it properly. right now I am facing issue in adding platform for android. This is my cordova version

9.0.0 ([email protected])

This is the error i am getting , can anyone help me to solve this

Using cordova-fetch for cordova-android@^8.0.0
Failed to fetch platform cordova-android@^8.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code ENOENT

Platforms

Available platforms:
  android ^8.0.0
  browser ^6.0.0
  electron ^1.0.0
  ios ^5.0.0
  osx ^5.0.0
  windows ^7.0.0
2

There are 2 answers

0
Sampath On

08-08-2019

Ionic 4

I have a dev environment issue. I didn't use the latest Ionic CLI and Cordova CLI. After I updated those then no issues and I was able to build the APK.

$ ionic info

Ionic:

   Ionic CLI                     : 5.2.4 (C:\Users\Sampath\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.2.3
   @ionic/angular-toolkit        : 1.2.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 20 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.5

System:

   NodeJS : v12.4.0 (C:\Program Files\nodejs\node.exe)
   npm    : 2.15.12
   OS     : Windows 10 
1
clauub On

You should check what version of android is provided by cordova. You can check it in C:/Users/%USER%/.cordova/lib/npm-cache/cordova-android

Then, you install the Android platform version provided. For me it was @5.1.0 which was in my cordova-android folder. So I used the cmd line following:

cordova platform add [email protected] which should be a different version for you