本文介绍了无法添加任务':processDebugGoogleServices'作为具有该名称的任务已存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试firebase FCM插件,但它似乎有很多错误,在解决了很多错误之后是
,这里是我想要做的
离子cordova构建android ,我有这个错误:

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

我的build.gradle of Android是:

my build.gradle of Android is:

 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:

FCMPlugin.gradle :

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


推荐答案

在FCM摇篮,评论的最后一行(下面),其中包含Googleservicesplugin
的.\platforms \ android\cordova-plugin-fcm \your_app-FCMPlugin.gradle

In FCM Gradle, comment the last line (below) that contains 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

这篇关于无法添加任务':processDebugGoogleServices'作为具有该名称的任务已存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 07:35