I'm trying to add firebase push notifications into my mobile application, but i'm stuck in a vicious cycle when trying to build with android studios.
Firebase tells me to add the dependency into my root build.gradle
file, which as i'm using cordova is platforms/android/build.gradle
, so once i've added it my buildscript dependencies look like this
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:4.1.0' // google-services dependency from cordova-plugin-firebase
classpath 'io.fabric.tools:gradle:1.25.4' // fabric dependency from cordova-plugin-firebase
}
and I add this line at the bottom of the build.gradle
file also
apply plugin: 'com.google.gms.google-services'
Then when I try to build I get the following error in android studios
Cannot add task ':processDebugGoogleServices' as a task with that name already exists.
When I google the error, I land on this stack overflow question, which says apparently to remove the google-services
line from the dependencies. So when I do that and try to rebuild, I get the following error
Plugin with id 'com.google.gms.google-services' not found.
Then when I google that error I land on this stack overflow question that tells me to remove the line i've added, and the cycle starts again!
I'm very new to cordova/app development and i'm not 100% sure if i'm doing something completely wrong.
Incase it helps, heres my plugin list when i run cordova plugin list
cordova-open 1.0.12 "Open"
cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-contacts 2.3.1 "Contacts"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-fcm 2.1.2 "FCMPlugin"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-fingerprint-aio 1.6.0 "FingerprintAllInOne"
cordova-plugin-firebase 2.0.5 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-inappbrowser 1.7.2 "InAppBrowser"
cordova-plugin-ios-camera-permissions 1.2.0 "iOS Permissions"
cordova-plugin-keyboard 1.2.0 "Keyboard"
cordova-plugin-listpicker 2.2.2 "ListPicker"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-mauron85-background-geolocation 2.3.6 "CDVBackgroundGeolocation"
cordova-plugin-pin-dialog 0.1.3 "PinDialog"
cordova-plugin-spinner 1.1.0 "Spinner Plugin"
cordova-plugin-spinnerdialog 1.3.2 "SpinnerDialog"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin"
cordova-support-google-services 1.3.1 "cordova-support-google-services"
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 1.11.1 "PushPlugin"
I'm thinking maybe I have clashing plugins? Can someone please let me know what i'm doing wrong, its all quite confusing to me at the moment!
If anything i've specified above like the root build.gradle location is wrong, please let me know! As i said i'm quite new to this and i'm not 100% sure if everything i've said is correct!