Firebase Cloud Messaging and Google Authentication Services


#1

Hello Folks,

I have tried searching at a ton of places to get FCM working. I am using Google Authentication API and have just installed FCM to use Push Notifications. I would like to use both of them. When i do build I get these errors.

  • What went wrong: A problem occurred evaluating root project ‘android’.

  • What went wrong: A problem occurred evaluating root project ‘android’.

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
        BUILD FAILED

        Total time: 3.002 secs
        > For input string: "+"

This is my project.properties file

target=android-25
android.library.reference.1=CordovaLib
cordova.system.library.1=com.facebook.android:facebook-android-sdk:4.+
cordova.system.library.2=com.google.android.gms:play-services-auth:+
cordova.system.library.3=com.google.android.gms:play-services-identity:+
cordova.system.library.4=com.android.support:support-v13:25.1.0
cordova.system.library.5=me.leolin:ShortcutBadger:1.1.17@aar
cordova.system.library.6=com.google.firebase:firebase-messaging:11.0.1
cordova.gradle.include.1=phonegap-plugin-push/starter-push.gradle

Couple of things I tried after reading lot of posts: 1. I removed and added android platform then did the build. 2. I tried changing the versions of below libraries to numerous values, but it does not help.

cordova.system.library.2=com.google.android.gms:play-services-auth:+
cordova.system.library.3=com.google.android.gms:play-services-identity:+ 

If I try changing the version from + to 3.0.0 or 9.8.0 or any version I get this error for firebase

* What went wrong:
        A problem occurred configuring root project 'android'.
        > Could not resolve all dependencies for configuration ':_debugApkCopy'.
        > Could not find com.google.firebase:firebase-messaging:11.0.1.
        Required by:
        project :

Note: Changing the same inside the build.gradle file dosen’t help as it gets overridden when we do a build.

this is my package.json.

{
    "name": "test",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve",
        "start": "node ./bin/www"
    },
    "dependencies": {
        "@angular/common": "4.1.2",
        "@angular/compiler": "4.1.2",
        "@angular/compiler-cli": "4.1.2",
        "@angular/core": "4.1.2",
        "@angular/forms": "4.1.2",
        "@angular/http": "4.1.2",
        "@angular/platform-browser": "4.1.2",
        "@angular/platform-browser-dynamic": "4.1.2",
        "@ionic-native/core": "3.10.2",
        "@ionic-native/facebook": "^3.10.2",
        "@ionic-native/google-plus": "^3.12.1",
        "@ionic-native/native-storage": "^3.10.3",
        "@ionic-native/splash-screen": "3.10.2",
        "@ionic-native/status-bar": "3.10.2",
        "@ionic/storage": "2.0.1",
        "body-parser": "^1.17.2",
        "cordova-android": "^6.2.3",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-facebook4": "^1.9.0",
        "cordova-plugin-googleplus": "^5.1.1",
        "cordova-plugin-nativestorage": "^2.2.2",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.2",
        "cordova-plugin-whitelist": "^1.3.1",
        "express": "^4.15.3",
        "ionic-angular": "3.3.0",
        "ionic-native": "^2.5.1",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "mongoose": "^4.11.4",
        "morgan": "^1.8.2",
        "phonegap-plugin-push": "^2.0.0",
        "rxjs": "5.1.1",
        "serve-favicon": "^2.4.3",
        "socket.io": "^2.0.3",
        "socket.io-client": "^2.0.3",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.11"
    },
    "devDependencies": {
        "@ionic/app-scripts": "1.3.7",
        "@ionic/cli-plugin-cordova": "1.6.2",
        "@ionic/cli-plugin-ionic-angular": "1.4.1",
        "ionic": "3.7.0",
        "typescript": "2.3.3"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-facebook4": {
                "APP_ID": "xxxxxxx2",
                "APP_NAME": "test"
            },
            "cordova-plugin-googleplus": {
                "REVERSED_CLIENT_ID": "4xxxxxxxx6-7dsgct91usuntkmomme1n8rq5i7oipq8.apps.googleusercontent.com"
            },
            "phonegap-plugin-push": {
                "SENDER_ID": "81xxxxx8690"
            }
        },
        "platforms": [
            "android"
        ]
    },
    "main": "index.js",
    "keywords": [
        "server"
    ],
    "license": "ISC"
}

Can some one please help me out, suggest a better approach to implement Push notification. Thanks in advance!
I just followed this tutorial https://ampersandacademy.com/tutorials/ionic-framework-version-2/push-notification-in-ionic-2-native-plugin-version-2-3-with-firebase-hosting-service-provider


#2

You solved this problem? Because I’m having the same errors.


#3

Apparently no, I had to remove the google services plugin. I plan to use the less user friendly Google Web API authentication later on. When you remove the google services plugin the FCM works just fine!.

I don’t wish to get stuck and break my head on these silly version conflicts.


#4

Hey guys, any updates on the problem?
I’m facing the same right now and no clue how to solve. I have also tried to change the version numbers in the project.properties document without success…
Everything started when I wanted to add Firebase to my project.

Cheers, Jerome.


#5

I found a simple, easy to set up service, for doing push notifications. It’s OneSignal. They have simple to follow instructions and it was easy to get running and it works great. And did I mention, it is free!

OneSignal.com


#6

Has anyone solved this?


#7

A quick fix on my side:
choose remove one of firebase or firebase-analytics plugins. Then, delete the plugin folder. Remove and add the platform. All works then.