无法添加任务 'processDebugGoogleServices',因为同名任务已存在

Cannot add task 'processDebugGoogleServices' as a task with that name already exists

What went wrong? org.gradle.api.internal.tasks.DefaultTaskContainer$DuplicateTaskException: Cannot add task 'processDebugGoogleServices' as a task with that name already exists.

I want to test firebase FCM plugin, but it seems to have a lot of errors, 
after solved many of them, here what I'm trying to do: ionic cordova build 
android, I have this error:

ionic info:

platforms\android\cordova-plugin-fcm-with-dependecy-updated:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        mavenLocal()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.+'
        classpath 'com.google.gms:google-services:3.1.+'
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}
repositories {
    mavenCentral()
    jcenter()
}
dependencies {
    compile 'com.google.firebase:firebase-core:10.+'
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin 
from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

platforms\android\cordova-support-google-services

buildscript {
        repositories {
            jcenter()
            mavenCentral()
            google()
        }

dependencies {
    classpath 'com.android.tools.build:gradle:+'
    classpath 'com.google.gms:google-services:3.2.0'
    classpath 'com.android.tools.build:gradle:3.0.1'


       }
    }

    // apply plugin: 'com.google.gms.google-services'
    // class must be used instead of id(string) to be able to apply 
plugin from non-root gradle file
ext.postBuildExtras = {
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

我在使用该插件时遇到过几个问题,包括您上面提到的那个。我的问题是我的 platforms/android/src/build.gradle,出于某种未知原因,在删除重复项后有重复的依赖项(com.google.firebase:firebase-messaging & com.google.firebase:firebase-core)一切正常。希望这对您有所帮助!

对我有用的是改变行:

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

platforms\android\cordova-plugin-fcm-with-dependecy-updated

对此:

ext.postBuildExtras = {
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

我从 package.json.

中删除了 {phonegap-plugin-push": "2.2.3",}

my "package.json" was ..

{
"name": "TaxMan_v2",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
  "scripts": {
   "ng": "ng",
   "start": "ng serve",
   "build": "ng build",
   "test": "ng test",
   "lint": "ng lint",
   "e2e": "ng e2e"
 },
"private": true,
"dependencies": {
  "@angular/common": "^7.2.2",
  "@angular/core": "^7.2.2",
  "@angular/forms": "^7.2.2",
  "@angular/http": "^7.2.2",
  "@angular/platform-browser": "^7.2.2",
  "@angular/platform-browser-dynamic": "^7.2.2",
  "@angular/router": "^7.2.2",
  "@ionic-native/core": "^5.0.0",
  "@ionic-native/splash-screen": "^5.0.0",
  "@ionic-native/status-bar": "^5.0.0",
  "@ionic/angular": "^4.0.0",
  "@ionic/storage": "^2.2.0",
  "chart.js": "^2.7.3",
  "cordova-android": "7.1.4",
  "cordova-plugin-device": "2.0.2",
  "cordova-plugin-fcm-with-dependecy-updated": "2.4.0",
  "cordova-plugin-ionic-keyboard": "^2.0.5",
  "cordova-plugin-ionic-webview": "^3.0.0",
  "cordova-plugin-ms-azure-mobile-apps": "^2.0.2",
  "cordova-plugin-splashscreen": "5.0.2",
  "cordova-plugin-statusbar": "2.4.2",
  "cordova-plugin-whitelist": "^1.3.3",
  "cordova-support-google-services": "1.1.0",
  "core-js": "^2.5.4",
  "phonegap-plugin-multidex": "1.0.0",
  "phonegap-plugin-push": "2.2.3",
  "rxjs": "~6.3.3",
  "zone.js": "~0.8.29"
},
"devDependencies": {
  "@angular-devkit/architect": "~0.12.3",
  "@angular-devkit/build-angular": "~0.12.3",
  "@angular-devkit/core": "~7.2.3",
  "@angular-devkit/schematics": "~7.2.3",
  "@angular/cli": "~7.2.3",
  "@angular/compiler": "~7.2.2",
  "@angular/compiler-cli": "~7.2.2",
  "@angular/language-service": "~7.2.2",
  "@ionic/angular-toolkit": "~1.2.0",
  "@types/node": "~10.12.0",
  "@types/jasmine": "~2.8.8",
  "@types/jasminewd2": "~2.0.3",
  "codelyzer": "~4.5.0",
  "jasmine-core": "~2.99.1",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~3.1.4",
  "karma-chrome-launcher": "~2.2.0",
  "karma-coverage-istanbul-reporter": "~2.0.1",
  "karma-jasmine": "~1.1.2",
  "karma-jasmine-html-reporter": "^0.2.2",
  "protractor": "~5.4.0",
  "ts-node": "~8.0.0",
  "tslint": "~5.12.0",
  "typescript": "~3.1.6"
},
"description": "An Ionic project",
"cordova": {
  "plugins": {
    "cordova-plugin-whitelist": {},
    "cordova-plugin-statusbar": {},
    "cordova-plugin-device": {},
    "cordova-plugin-splashscreen": {},
    "cordova-plugin-ionic-webview": {},
    "cordova-plugin-ionic-keyboard": {},
    "cordova-plugin-fcm-with-dependecy-updated": {}
  },
  "platforms": [
    "android"
    ]
  }
}