Firebase Cordova Plugin not working

#1

HI Everyone,

I was using Cordova Plugin Firebase package for push notifications and it works pretty well.

But today got the error while building the build for Android.

This is the error message I got when running the project

The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.5.0,16.5.0], [16.4.0,16.4.0]], but resolves to 16.5.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

Also, On Github this is an open issue. Although, few of the users commenting that they have succesfully counter the issue but their solution not working for me.

Also, Can anyone tell me how to create a project.properties files while building the app for Cordova? I am asking this because some of the users mention adding the project.properties file in their project solves the issue.

#2

Add cordova-play-services-version-adapter plugin…I think it tries to resolve the play services versions requested by various plugins. It solves my firebase problem.

#3

Are you using the same version cordova firebase plugin 2.0.5 or any other plugin?

Can you please check and revert which plugin are you using right now!

#4

I do not use the cordova firebase plugin directly. It is used by raix:push package. It is npm firebase-admin 7.0.0.
Hope this helps

#5

Okay, let me check for this!
Thanks

#6

@perumalkuk, I checked that but its not working

I got this error before starting the App and then the same error

‘Cordova Play Services Version Adapter’ has detected an error. The following dependencies of ‘Google Play Services’ are not compatible:
You have an incompatibility of versions with the following dependencies of ‘Google Play Services’:
- ‘com.google.android.gms:play-services-auth:11.8.0’
- ‘com.google.android.gms:play-services-identity:11.8.0’
- ‘com.google.android.gms:play-services-tagmanager:+’
- ‘com.google.firebase:firebase-core:+’
- ‘com.google.firebase:firebase-messaging:+’
- ‘com.google.firebase:firebase-config:+’
- ‘com.google.firebase:firebase-perf:+’

It doesn’t exists a version of ‘Google Play Services’ that includes all these dependencies.
All dependencies of ‘Google Play Services’ must have the same version.
The application may not compile.

BUILD FAILED in 2m 17s
{ Error: /usr/Data/Meteor/sn_aws-web/.meteor/local/cordova-build/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • What went wrong:
    The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.5.0,16.5.0], [16.4.0,16.4.0]], but resolves to 16.5.0. Disable the plugin and check your
    dependencies tree using ./gradlew :app:dependencies.

It does not work, can you please check whats the issue?

#7

You may have to use adapters similar to one I have mentioned(check cordova-android-support-gradle-release or cordova-android-firebase-gradle-release - check their documentation), that helps sort the problem. it is trial and error and choosing the right version of plugin so that dependencies match

#8

Hi,
in your Android project you need to add all those latest versions for Firebase messaging and the rest of the Android plugins in android/app/ build.gradle. For Firebase Messaging you might end up with 11… instead of 17. while the latests is 18 I believe.
In this Meteor Push package https://github.com/activitree/meteor-push I use cordova-android-support-gradle-release@1.4.5 to overcome this error you have now. However the latested version of this plugin is now 3+.

#9

Solution Worked for Me, Go to .meteor/local/cordova-build/platforms/android/project.properties
and changing the following (in Bold)

target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.google.android.gms:play-services-auth:11.8.0
cordova.system.library.2=com.google.android.gms:play-services-identity:11.8.0
cordova.gradle.include.1=cordova-plugin-meteor-webapp/specialn-build-extras.gradle
cordova.system.library.3=com.squareup.okhttp3:okhttp:3.9.1
cordova.system.library.4=com.facebook.android:facebook-android-sdk:4.38.1
cordova.gradle.include.2=cordova-plugin-firebase/specialn-build.gradle
cordova.system.library.5=com.google.android.gms:play-services-tagmanager:16+
cordova.system.library.6=com.google.firebase:firebase-core:16.0.8
cordova.system.library.7=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.8=com.google.firebase:firebase-config:16.4.1
cordova.system.library.9=com.google.firebase:firebase-perf:16.2.4
cordova.gradle.include.3=cordova-android-support-gradle-release/specialn-cordova-android-support-gradle-release.gradle

#10

Thanks @paulishca, I found the solution of the problem.

I will try using this plugin you suggested.

#11

Thanks @perumalkuk, Found the solution!!

#12

Great. But if it is editing project.properties …then it may not be the right solution. I would suggest exploring the right way of using cordova-android-support-gradle-release or the other as suggested above by passing the right parameters using mobile-config.js file using custom config plugin to the cordova plugins