Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add task ':app:processDebugGoogleServices' as a task with that name already exists #578

Open
EmilienRamos opened this issue Apr 15, 2019 · 18 comments

Comments

@EmilienRamos
Copy link

Hey !

I download ionic cordova plugin add cordova-plugin-fcm in order to send and to receive push notification from device to Firebase.

Unfortunately, when I launch ionic cordova run android --device, I got this issue :

BUILD FAILED in 1s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot add task ':app:processDebugGoogleServices' as a task with that name already exists.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

This is my /platforms/android/cordova-plugin-fcm/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'
// 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

Does someone have an idea ?

@diffTed
Copy link

diffTed commented May 14, 2019

Hi,

change the last line of code ( /platforms/android/cordova-plugin-fcm/FCMPlugin.gradle):
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

to this:

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

and build will work.

@anteAdamovic
Copy link

Any update on this ? Facing the same issue.

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot add task ':app:processDebugGoogleServices' as a task with that name already exists.

@firmanpurnama
Copy link

yes i have the same problem

@arthurduarte1
Copy link

Same problem here.

@AmnahAlabdulal
Copy link

any update ? I have the same issue

@pawan-logiciel
Copy link

What works for me was changing the line:

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

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

to this:

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

or if you have install phonegap-plugin-push then remove it and try again

@invincibleP
Copy link

Hello all!
I am facing one serious issue after adding below plugin (which is very essential for me)

$ ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
$ npm install @ionic-native/fcm

Build failed

  • What went wrong:
    A problem occurred configuring project ':app'.

org.gradle.api.internal.tasks.DefaultTaskContainer$DuplicateTaskException: Cannot add task 'processDebugGoogleServices' as a task with that name already exists.

I have already installed:

$ ionic cordova plugin add cordova-plugin-firebase-authentication
$ npm install @ionic-native/firebase-authentication

and i could build it after adding this plugin..

Is this versioning issue? if yes how to resolve this? Can anyone guide?

My project files

app-FCMPlugin.gradle

buildscript {
repositories {
mavenCentral()
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.google.gms:google-services:3.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

build.gradle

buildscript {
repositories {
google()
jcenter()
}

dependencies {
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files

    classpath 'com.android.tools.build:gradle:3.3.0'
}

}

allprojects {
repositories {
google()
jcenter()
}

//This replaces project.properties w.r.t. build settings
project.ext {
  defaultBuildToolsVersion="28.0.3" //String
  defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
  defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
  defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
}

}

task clean(type: Delete) {
delete rootProject.buildDir
}

package.json

"name": "DevApp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.2.2",
"@angular/cdk": "^7.3.7",
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/flex-layout": "^7.0.0-beta.24",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.2",
"@angular/material": "^7.3.7",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.19",
"@fortawesome/free-solid-svg-icons": "^5.9.0",
"@ionic-native/android-full-screen": "^5.9.0",
"@ionic-native/android-permissions": "^5.10.0",
"@ionic-native/calendar": "^5.10.0",
"@ionic-native/contacts": "^5.10.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/device": "^5.8.0",
"@ionic-native/fcm": "^5.11.0",
"@ionic-native/file": "^5.9.0",
"@ionic-native/file-opener": "^5.10.0",
"@ionic-native/file-transfer": "^5.9.0",
"@ionic-native/firebase-authentication": "^5.11.0",
"@ionic-native/geolocation": "^5.8.0",
"@ionic-native/http": "^5.8.0",
"@ionic-native/local-notifications": "^5.10.0",
"@ionic-native/photo-viewer": "^5.10.0",
"@ionic-native/social-sharing": "^5.10.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic-native/youtube-video-player": "^5.8.0",
"@ionic/angular": "^4.1.0",
"@ionic/storage": "^2.2.0",
"color": "^3.1.2",
"com-sarriaroman-photoviewer": "1.2.4",
"cordova-android": "8.0.0",
"cordova-plugin-advanced-http": "2.1.1",
"cordova-plugin-android-permissions": "1.0.0",
"cordova-plugin-badge": "0.8.8",
"cordova-plugin-calendar": "5.1.4",
"cordova-plugin-contacts": "3.0.1",
"cordova-plugin-fcm-with-dependecy-updated": "2.4.0",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-opener2": "2.2.0",
"cordova-plugin-file-transfer": "1.7.1",
"cordova-plugin-firebase-authentication": "3.0.0",
"cordova-plugin-fullscreen": "1.2.0",
"cordova-plugin-geolocation": "4.0.1",
"cordova-plugin-local-notification": "0.9.0-beta.2",
"cordova-plugin-native-keyboard": "^2.0.3",
"cordova-plugin-x-socialsharing": "5.4.7",
"cordova-plugin-youtube-video-player": "2.3.0",
"cordova-sqlite-storage": "3.2.0",
"cordova-support-android-plugin": "1.0.1",
"cordova-support-google-services": "1.3.1",
"core-js": "^2.5.4",
"es6-promise-plugin": "4.2.2",
"hammerjs": "^2.0.8",
"ionic4-date-picker": "^0.1.0",
"moment": "^2.24.0",
"ngx-audio-player": "^7.1.3",
"ngx-moment": "^3.4.0",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/architect": "~0.13.8",
"@angular-devkit/build-angular": "~0.13.8",
"@angular-devkit/core": "~7.3.8",
"@angular-devkit/schematics": "~7.3.8",
"@angular/cli": "~7.3.8",
"@angular/compiler": "~7.2.2",
"@angular/compiler-cli": "~7.2.2",
"@angular/language-service": "~7.2.2",
"@ionic/angular-toolkit": "~1.5.1",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~12.0.0",
"codelyzer": "~4.5.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-webview": "^4.1.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"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.1.0",
"tslint": "~5.17.0",
"typescript": "~3.1.6"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-advanced-http": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-youtube-video-player": {},
"cordova-sqlite-storage": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-file": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-file-opener2": {},
"cordova-plugin-fullscreen": {},
"cordova-plugin-calendar": {},
"cordova-plugin-contacts": {},
"cordova-plugin-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
},
"cordova-plugin-local-notification": {},
"cordova-plugin-android-permissions": {},
"com-sarriaroman-photoviewer": {},
"cordova-plugin-native-keyboard": {
"LICENSE": "TRIAL",
"LIC_ANDROID": "TRIAL"
},
"cordova-plugin-fcm-with-dependecy-updated": {},
"cordova-plugin-firebase-authentication": {
"FIREBASE_AUTH_VERSION": "18.0.+"
}
},
"platforms": [
"android"
]
}
}

app.build.gradle

buildscript {
repositories {
google()
jcenter()
mavenCentral()
}

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

}

// use postBuildExtras to make sure the plugin is applied after
// cdvPluginPostBuildExtras. Therefore if googleServices is added
// to cdvPluginPostBuildExtras somewhere else, the plugin execution
// will be skipped and project build will be successfull
ext.postBuildExtras = {
if (project.extensions.findByName('googleServices') == null) {
// 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
}
}

A prompt response would be appreciated!

@invincibleP
Copy link

@pawan-logiciel thanks but it's not working. I tried it.
I don't think its a stable plugin!

@MarcosRibeiroJesus
Copy link

Same here...

@Khaledalien
Copy link

I'm struggling with ionic after adding any plugin. I hate ionic

@dashko
Copy link

dashko commented Sep 12, 2019

None of the solutions worked for me.

@K-Desu Indeed, any change in plugins results in errors, and hours of googling...

@RanajitManna
Copy link

A problem occurred configuring project ':app'.

org.gradle.api.internal.tasks.DefaultTaskContainer$DuplicateTaskException: Cannot add task 'processDebugGoogleServices' as a task with that name already exists.

@gildonei
Copy link

Does anyone solved this issue?

@pawan-logiciel
Copy link

@RanajitManna i think it comes due to update of google services you can try this by uninstall
cordova-support-google-services plugin and add it from https://github.com/chemerisuk/cordova-support-google-services here i think that might solve your problem

@gildonei
Copy link

I just got able to "solve" by creating an empty project and compiling it from scratch and after that add plugins one by one until complete the project, the final code was exactly the same from before the bug.

@abdullahbhojani
Copy link

Hi
Please make sure that you are using only this package
make sure to uninstall or remove the previous packages related to FCM.
I was using firebase-x
so first I removed firebase-x
than I installed cordova-plugin-fcm-with-dependecy-updated.
this works for me

@abdullahbhojani
Copy link

Hi
Please make sure that you are using only this package
make sure to uninstall or remove the previous packages related to FCM.
I was using firebase-x
so first I removed firebase-x
than I installed cordova-plugin-fcm-with-dependecy-updated.
this works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests