I installed cordova and create a new project.
But when I use this command to add android platform:
cordova platform add android
it just because cannot dowload cordova-android package.Just do it like this,it is done: cnpm install cordova-android@^7.1.4 --save
I faced same issue and I fixed by performing following steps.
Please add C:\Windows\System32
in envrionment variable paths
Ensure jdk/bin
path is setup under JAVA_HOME
and path
Ensure SDK path is setup under ANDROID_HOME
and path
I had the same issue the way I fixed it was I did the following.
ionic platform add android
This should fail and give the error your getting. cordova platform rm android && cordova platform add android
The reason I found it was not fetching was because cordova was looking for Andriod SDK matching the version 7.1.4 but was not able to find it at the preset location normal "andriod/Sdk".
Had the same issue after using nvm to switch node version. Just removing android platform and reinstalling it works for me:
cordova platform rm android && cordova platform add android
I had this same problem, however, the issue was a missing peer dependency on acorn
.
Adding acorn
to the devDependencies
section of my package.json
did the trick.
So my suggestion is to look for missing peer dependencies and add them to the devDependencies
section of your package.json
.
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