cordova-plugin-firebase-analytics: Firebase plugins has a conflict (fcm and analytics)

Installing both cordova-plugin-fcm and cordova-plugin-firebase-analytics result in an error that does not allow building using cordova.

Cannot add task ‘:processDebugGoogleServices’ as a task with that name already exists.

(x-issue: https://github.com/fechanique/cordova-plugin-fcm/issues/398)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 25 (1 by maintainers)

Most upvoted comments

I had a chance to sit down and give this a go myself today. Managed to get the build to compile with minimal changes to the originals!

My steps were:

ionic start blank
cordova platform add android
cordova plugin add cordova-plugin-fcm # stock plugin from npm
# add valid google-services.json
cordova plugin add cordova-plugin-firebase-analytics # stock plugin from npm
cordova build android --device
# compiler shows error as above

I modified dev-build.gradle on cordova-support-google-services so it using google-services:3.0.0 instead of 3.1.0 as suggested above, and then after doing cordova build android --device then it compiles successfully! So you only need to modify cordova-support-google-services and none of the library versions for firebase.

I am also experiencing the same, and also posted this under Issue #51.

When I run: cordova build android I get the following: What went wrong: A problem occurred configuring root project android. Cannot add task :processDebugGoogleServices' as a task with that name already exists.

I am attempting to use Firebase Analytics (cordova-plugin-firebase-analytics) which requires the plugin, Google Services (cordova-support-google-services). I am also using Firebase Cloud Messaging (cordova-plugin-fcm). The cordova-plugin-fcm includes Google Services 3.0.0 and the cordova-support-google-services has Google Services at 3.1.0 creating the conflict.

I am new to using Ionic 3/Angular 4. A fix I had found on a different forum, and implemented, was changing the version in platforms/android/cordova-support-google-services to 3.0.0 from 3.1.0. This was only a temporary fix, and a Sr. Dev on my team said this was terrible and should never be done. Of course, I do not want to do something that is a bad practice, however, what this error informed me of is that if I can get the dependencies at the same version, then the conflict resolves and the project builds.

Any guidance you can offer would be extremely helpful.

Thank you!

In case it helps anyone, I currently have everything working with following versions: Cordova - 7.1.0 (backed off from 8 due to compatibility issues with some plugins (sorry, can’t remember which ones) phonegap-plugin-push - 2.1.3 cordova-plugin-firebase-analytics - 0.12.1

Also important was to install the plugins with the following commands (note the variables): cordova plugins add cordova-plugin-firebase-analytics --variable FIREBASE_VERSION=“11.6.2” cordova plugins add phonegap-plugin-push --variable FCM_VERSION=“11.6.2”

6.2.3 same error

Thanks @CookieCookson

That solution gives the following error:

Could not get unknown property ‘FIREBASE_VERSION’ for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Of course, still, removing the analytics plugin manages to build