【问题标题】:Cannot add task 'processDebugGoogleServices' as a task with that name already exists无法添加任务“processDebugGoogleServices”,因为具有该名称的任务已存在
【发布时间】:2019-08-07 19:19:48
【问题描述】:

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

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:

离子信息:

平台\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

平台\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
}

【问题讨论】:

    标签: ionic4


    【解决方案1】:

    对我有用的是换行:

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

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

    到这里:

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

    【讨论】:

    • 适用于 Cordova Android 6.4.0
    【解决方案2】:

    我的插件也有几个问题,包括你上面提到的那个。我的问题是,由于某种未知原因,我的平台/android/src/build.gradle 在删除重复项后有重复的依赖项(com.google.firebase:firebase-messaging & com.google.firebase:firebase-core)一切正常美好的。希望这会有所帮助!

    【讨论】:

      【解决方案3】:

      我从 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"
          ]
        }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-08-29
        • 2018-08-18
        • 2019-08-02
        相关资源
        最近更新 更多