Cannot build for Android - Error: version not found: cordova-plugin-googleplayservices@19.0.0

I’m having an issue creating an Android build of my Ionic project. The iOS version builds fine and I can even build it on device, but I’ve ran into several errors when trying to build Android.

I decided to start all over and create the project from scratch again. Again, the iOS version builds fine, but the Android project still won’t build.

I’m using the command: ionic platform add android

I have no idea why it’s trying to download this plugin, because it’s not in my main plugins folder.

I’ve updated the Android SDK by downloading all Extras and matching the Build Tools version with the Platform Tools version.

Admittedly, I’m not a big Android guy, but I don’t have any issues building Android for straight Cordova projects (non-Ionic).

The latest error is this:

Error: Failed to fetch plugin cordova-plugin-googleplayservices@19.0.0 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: version not found: cordova-plugin-googleplayservices@19.0.0

On my original project I can successfully do a “ionic platform add android”, but when I do a “ionic build android” I get this error:

BUILD FAILED

Total time: 5.272 secs

/PhoneGap/iOS/CisnerosTrainingGroup/project/barebone-     ionic/platforms/android/cordova/node_modules/q/q.js:126
                throw e;
                ^
Error code 1 for command: /PhoneGap/iOS/CisnerosTrainingGroup/project/barebone-    ionic/platforms/android/gradlew with args: cdvBuildDebug,-   b,/PhoneGap/iOS/CisnerosTrainingGroup/project/barebone-ionic/platforms/android/build.gradle,-    Dorg.gradle.daemon=true
 ERROR building one of the platforms: Error:     /PhoneGap/iOS/CisnerosTrainingGroup/project/barebone-ionic/platforms/android/cordova/build:     Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /PhoneGap/iOS/CisnerosTrainingGroup/project/barebone-    ionic/platforms/android/cordova/build: Command failed with exit code 1

I sorted it out.

I replaced the config.xml with an original and unmodified one (i.e. from the generated project) and then built again without errors.