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

我想测试firebase FCM插件,但似乎有很多错误, 在解决了许多问题之后,我就是这样 尝试做:ionic cordova build android,我有这个错误:

我的 Android 的 build.gradle 是:

 dependencies {
        classpath 'com.android.tools.build:gradle:2.2.1'
        classpath 'com.google.gms:google-services:3.1.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.firebase:firebase-core:+"
    compile "com.google.firebase:firebase-messaging:+"
    compile "com.google.android.gms:play-services-maps:9.8.0"
    compile "com.google.android.gms:play-services-location:9.8.0"
    compile "com.android.support:support-v13:23+"
    compile "com.google.android.gms:play-services-gcm:11+"
    compile "me.leolin:ShortcutBadger:1.1.14@aar"
    // SUB-PROJECT DEPENDENCIES END
}
apply plugin: 'com.google.gms.google-services'

FCMPlugin.gradle:

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

【问题讨论】:

    标签: angular cordova firebase ionic2 firebase-cloud-messaging


    【解决方案1】:

    在 FCM Gradle 中,注释包含 Googleservicesplugin 的最后一行(下方) ".\platforms\android\cordova-plugin-fcm\your_app-FCMPlugin.gradle"

    buildscript {
    repositories {
    jcenter()
    mavenLocal()
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:+'
    classpath 'com.google.gms:google-services:3.0.0'
    }
    }
    // apply plugin: 'com.google.gms.google-services' <---- COMMENT THIS LINE TOO, add to Root gradle file
    // 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 <---- COMMENT THIS LINE
    

    【讨论】:

      猜你喜欢
      • 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
      相关资源
      最近更新 更多