Search code examples
androidfirebasefirebase-cloud-messagingfirebase-console

Firebase Warning to use firebase-core library when using firebase-messaging library


I am using firebase:firebase-messaging library for push notification.
While building the application I am seeing a warning which says

Warning: The app Gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended.

Release notes by firebase say https://developers.google.com/android/guides/releases#may_23_2018

Firebase now requires the app Gradle file to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.

Firebase-core library is used for analytics, what will happen if I don't include this library? I am already using gms:play-services-analytics.
Also, I have found the library version for both gms:play-services-analytics must be the same as firebase:firebase-core library to avoid any build error.

Something like below

implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'

Will there be any impact on the application if I will include firebase:firebase-core library in application gradle along with gms:play-services-analytics?

Why firebase is showing the above warning ?
What will be impacted if I don't include firebase-core with firebase-messaging library? A warning can be ignored?
Is this due to firebase adding analytics for all its features?
Here: https://support.google.com/firebase/answer/6383877?hl=en


Solution

  • If you don't include com.google.firebase:firebase-core, then you won't be able to use the other firebase services like firebase-database or firebase-messaging.

    If you are using google-service version 3.2.1+, then you can use different library versions for gms:play-services-analytics and firebase:firebase-core.