Firebase Firebase plugin notification - unable to add task: processDebugGoogleServices' as a task with the same name already exists

I am trying to add Google Firebase notifications to my Phonegap Cordova application built with Ionic. I have already successfully installed the Google Plus plugin for login (I think this will be useful information).

I only need this Firebase plugin to complete my work, but I was stopped by this error when I created an Android application.

There was a problem setting up the root project 'android'. Cannot add task ': processDebugGoogleServices' as a task with the same name already exists.

I follow this guide to configure the Cordova Firebase Cloud Messaging plugin for Android

Here is my build.gradle file edited as stated in the lesson:

apply plugin: 'com.android.application' buildscript { repositories { mavenCentral() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0' classpath 'com.google.gms:google-services:3.0.0' } } -------- dependencies { compile fileTree(dir: 'libs', include: '*.jar') // SUB-PROJECT DEPENDENCIES START debugCompile(project(path: "CordovaLib", configuration: "debug")) releaseCompile(project(path: "CordovaLib", configuration: "release")) compile "com.google.android.gms:play-services-plus:9.2.0" compile "com.google.android.gms:play-services-identity:9.2.0" compile "com.android.support:support-v4:+" compile "com.android.support:appcompat-v7:+" compile "com.android.support:appcompat-v7:23.2.1" compile "com.google.firebase:firebase-messaging:9.0.2" // SUB-PROJECT DEPENDENCIES END } apply plugin: 'com.google.gms.google-services' 
+8
source share
5 answers

There was the same problem. It looks like com.android.application already includes google services. To fix this, delete:

 apply plugin: 'com.google.gms.google-services' 
+4
source

use classpath 'com.android.tools.build:gradle:2.2.2' instead of classpath 'com.android.tools.build:gradle:2.2.0'

and use the dependency

 compile 'com.google.firebase:firebase-auth:10.0.1' compile 'com.google.firebase:firebase-messaging:10.0.1' compile 'com.google.android.gms:play-services-auth:10.0.1' 

make sure you add the json google_service file to the application folder

0
source

fcmplugin.gradle and build.gradle need google services

So change this:

 apply plugin : 'com.google.gms.google-services' 

to that:

 ext.postBuilderExtras = { apply plugin : com.google.gms.googleservices.GoogleServicesPlugin } 
0
source

Please follow this link. You will get an answer. I think the plugin is not installed correctly. [ https://angularfirebase.com/lessons/ionic-native-with-firebase-fcm-push-notifications-ios-android/โ€ [1]

0
source

I have found a solution.

  • remove android from project
  • add the android platform again (which reloads all the dependencies and the plugin)
  • repeat all the steps in this guide ( configure Firebase notifications )

Everything works well! The problem was the conflict between the Google Plus plugin and Firebase, which requires both of the same services.

-1
source

Source: https://habr.com/ru/post/1262919/


All Articles