Reputation: 944
Hey, Guys! I recently started to work with Cordova and when I run the Cordova platform add android
i get the following error. I have successfully placed the environment variables for Java and for the Android SDK as well. But the npm modules does not exist in C:/Windows/System32/npm as shown in the error, It is in the Users/My username/AppData/Roaming/npm folder. Some guidance would be appreciated.
I followed the following scripts which are shown in the official Cordova documentation to create a new project.
Cordova create hello com.example.hello HelloWorld
cd hello
Cordova platform add android -> where I'm stuck at
Upvotes: 0
Views: 764
Reputation: 944
I figured out halfway what the the problem was. There was a file named 'npm' in my C:/Windows/System32 directory wich was of 0kb size, and once i deleted it, the error vanished. But not all the way though. I was able to install the browser platform but not the android platform via cordova platform add android
or even specifying what the matching cordova-andriod pluggin to be with cordova platform add andriod@version
.
Only through the cordova platform add https://github.com/apache/cordova-android.git
script I could install the andriod platform and once it was done other steps worked fine, and the project ran through the Android AVD. Any idea why the normal command to add the android platform didnt work, Just want to know but if it happens again i think Im gonna have to run the get from git command again. Thanks
Upvotes: 0
Reputation: 156
Kindly Check the Android Version Provided by Cordova and verify with your current Android version installed on your system , if there a mismatch : 1) Update Android Version From Android Studio SDK Manager 2) Update Cordova Platform - Refer: Cordova Documentation
External Source cordova - Error: Failed to fetch platform android
Upvotes: 1