How to solve build failure with cordova-plugin-fcm?

After installing the cordova-plugin-fcm plugin, the command ionic run android fails with the following exception:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:processDebugGoogleServices’.

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog) or updating the version of com.google.android.gms to 9.2.0.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Found com.google.android.gms:play-services-analytics:+, but version 9.2.0 is needed for the google-services plugin.
:processDebugGoogleServices FAILED

BUILD FAILED

Total time: 3.015 secs

Error: Error code 1 for command: cmd with args: /s,/c,“C:\Projecten\ToDillo\ToDillo\platforms\android\gradlew cdvBuildDebug -b C:\Projecten\ToDillo\ToDillo\platforms\android\build.gradle -PcdvBuildArch=x86 -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true”

Caught exception:
undefined

Mind letting us know? Issues · ionic-team/ionic-cli · GitHub

1 Like

I think you have to update your android dependancies from the sdk manager.
And you need a few packages:

I installed everything in the extra folder, the error remains the same.
image

I changed the following line in the project.properties file and it compiles:

BEFORE:
cordova.system.library.1=com.google.android.gms:play-services-analytics:+
AFTER:
cordova.system.library.1=com.google.android.gms:play-services-analytics:9.2.0

Is this the best solution?

@jgeegj
I have a clean installation from RC.11 and in my platforms/android/projects.properties file I found this

cordova.system.library.1=com.android.support:support-v4:+

@twicejr
The error is demanding for [quote=“jgeegj, post:1, topic:61006”]
version of com.google.android.gms to 9.2.0
[/quote]

not more or less than 9.2.0 but how can one downgrade?

Comment the below line

apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

in {your project}/plugins\cordova-plugin-fcm\src\android\FCMPlugin.gradle

follow the link

Please try this solution.