I installed cordova and create a new project.
But when I use this command to add android platform:
cordova platform add android
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