Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova Firebase Plugin Notification - Cannot add task ':processDebugGoogleServices' as a task with that name already exists

i'm trying to add Google Firebase Notifications on my Phonegap Cordova app, built with Ionic. I've already installed successfully a Google Plus plugin for login (i think this would be a useful info).

I only need this Firebase plugin to complete my job but i've been stopped by this error when i build my app for Android.

A problem occurred configuring root project 'android'. Cannot add task ':processDebugGoogleServices' as a task with that name already exists.

I follow this tutorial for setup Cordova Plugin Firebase Cloud Messaging For Android

Here is my build.gradle file edited as the tutorial said:

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'
like image 721
Francesco Avatar asked Jan 17 '17 09:01

Francesco


1 Answers

Had the same issue. It appears com.android.application already includes google-services. To fix it remove:

apply plugin: 'com.google.gms.google-services'
like image 183
Luis Daniel López Avatar answered Sep 21 '22 15:09

Luis Daniel López