无法添加任务':processDebugGoogleServices'作为具有该名称的任务已存在
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了无法添加任务':processDebugGoogleServices'作为具有该名称的任务已存在相关的知识,希望对你有一定的参考价值。
我想测试firebase FCM插件,但它似乎有很多错误,在解决了很多错误后,在这里我正在尝试做什么:ionic cordova build 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'
}
答案
在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
以上是关于无法添加任务':processDebugGoogleServices'作为具有该名称的任务已存在的主要内容,如果未能解决你的问题,请参考以下文章
Gradle productFlavors 引发错误 - 无法添加任务“:assembleTest”,因为具有该名称的任务已存在
Flutter Notification OneSignal-无法确定任务':app:compileDebugJavaWithJavac'的依赖项
错误:任务':app:transformDexWithInstantRunSlicesApkForDebug'的执行失败。无法读取zip文件