ionic-cli: [CLI 3] Error trying to add android platform
Short description of the problem:
I’m trying to add the android platform to my project using ionic cordova platform add android
and I get the following error:
c:\xampp\htdocs\myproj>ionic cordova platform add android
> cordova platform add android --save
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova platform add android --save (exit code 1):
Error: Current working directory is not a Cordova-based project.
I tried to run cordova platform add android --save
as the error refers, and I get the following error:
c:\xampp\htdocs\myproj>cordova platform add android --save
Using cordova-fetch for cordova-android@~6.2.2
Error: Failed to fetch platform cordova-android@~6.2.2
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Failed to get absolute path to installed module
What behavior are you expecting?
adding android platform in the CLI 3
Steps to reproduce:
- run
ionic cordova platform add android
Post the output of ionic info
below please
global packages:
@ionic/cli-utils : 1.2.0
Cordova CLI : 7.0.1
Ionic CLI : 3.2.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.2.1
@ionic/cli-plugin-ionic-angular : 1.2.0
Cordova Platforms : none
Ionic Framework : ionic-angular 3.3.0
System:
Node : v6.10.3
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (2 by maintainers)
Try setting path = “C:\Windows\System32” in variable/system variable
@mhbt I did this: Try setting path = “C:\Windows\System32” in variable/system variable
Thank you madsongr, that solved my issue!!!
There seems to be an error with android@6.2.x and later. I had the same issue and using the below step was able to build my apk.
Do the following:
cordova platform remove android
Then add 6.1.2 specifically
cordova platform add android@6.1.2
Also found the following as an temporary workaround
cordova platform add android --nofetch