无法将任务“ processDebugGoogleServices”添加为具有该名称的任务

时间:2019-04-25 07:40:14

标签: ionic4

  

出了什么问题?   org.gradle.api.internal.tasks.DefaultTaskContainer $ DuplicateTaskException:    无法将任务“ processDebugGoogleServices”添加为具有该名称的任务    已经存在。

$("#item").autocomplete({
   source: function(request, response) {
      $.getJSON(
          "search.php",
          { term:request.term, type:'item' }, 
          response
      );
      $("#warning").hide();
   },
   minLength: 3,
   select: function(event, ui) {
      $("#warning").show();
      $("#item").html('');
   }

enter image description here

  

离子信息:

enter image description here

  

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

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:
  

platforms \ android \ cordova-support-google-services

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

3 个答案:

答案 0 :(得分:3)

对我有用的是更改线路:

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

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

对此:

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

答案 1 :(得分:1)

我在插件方面也遇到了一些问题,包括您在上面提到的问题。我的问题是,在删除重复项后,由于某些未知原因,我的platform / android / src / build.gradle具有重复的依赖项(com.google.firebase:firebase-messaging和com.google.firebase:firebase-core)精细。希望这会有所帮助!

答案 2 :(得分:0)

我从package.json中删除了{ phonegap-plugin-push“:” 2.2.3“ }。

  

我的“ package.json”是..

{
"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"
    ]
  }
}