Is `firebase-core` required for Firebase on Android?

14,306

UPDATE: AUGUST 2019

The docs now show whether a specific product SDK requires firebase-analytics, if firebase-analytics is recommended, or if it is not needed at all.

firebase-core is no longer listed as a required dependency in the Android getting started guide and was removed from the list of available libraries.

Now adding firebase-analytics to your app is optional in the getting started guide. Products that do require firebase-core, such as In-App Messaging, list the firebase-core dependency in their setup guides.


ORIGINAL ANSWER:

This is a recent change as of May 23, 2018. Per the release notes:

Your app gradle file now has to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.

This requirement is reflected in the "Set up {X} for Android" guides (example) in the step "Install the Firebase SDK". That step links to this page, which includes the requirement to add firebase-core.

edit 9/26/18: A summary of features that rely on Google Analytics for Firebase (and therefore firebase-core) can be found here.

Share:
14,306
Jeff
Author by

Jeff

I work on Firebase at Google

Updated on June 06, 2022

Comments

  • Jeff
    Jeff about 2 years

    As far as I know, individual Firebase libraries like firebase-auth didn't used to require me to include firebase-core.

    However, I recently started a new Android project, and when I tried to build without firebase-core, I got the following Java compiler warning:

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

  • Mitkins
    Mitkins almost 6 years
    I'm not a fan of this answer. Yes google says we should put it in, but if it's actually mandatory, why didn't google make it a required dependency in the maven POM file? Why make everyone explicitly reference it for no reason? This is doubly suspicous, because firebase-core is actually just google analytics for firebase; personally I want NOTHING to do with google analytics and it's privacy invading user-tracking, but can I really opt-out here? We use firebase-messaging as it's required to send push notifications to android
  • Ian Barber
    Ian Barber almost 6 years
    Firebaser here. That's a good comment! Where we have a hard dependency, we do add it as a POM dep. However, there are a bunch of services that have soft dependencies (FCM, Remote Config, Predictions, A/B Testing, Crashlytics etc.) where Analytics adds a lot of value. You can disable analytics tracking (firebase.google.com/support/guides/disable-analytics), which will mean you get enable it only if you have consent etc.
  • Rolf ツ
    Rolf ツ almost 6 years
    @IanBarber Thanks for explaining, but will keeping out firebase-core/firebase-analytics do any harm to the things that have soft dependencies?
  • Rolf ツ
    Rolf ツ almost 6 years
    @IanBarber I'm asking this because you are basically saying: "Analytics is useful so you must add the dependency, if you don't like it you can disable it". Why not leave it out in the first place then?
  • Stephen Ruda
    Stephen Ruda almost 6 years
    @IanBarber I am in a similar situation. I am only using FCM and everything seems to work without firebase-core dependency but I get the warning. Can I ignore the warning? I don't want to have to add additional dependencies if they don't actually do anything. Thanks!
  • Ian Barber
    Ian Barber almost 6 years
    You can ignore the warning with FCM, but it will stop some reporting of messaging open stats etc. in some cases.
  • racs
    racs over 5 years
    But I get this warning for a module in my project which doesn't use any other dependency than support annotations. How come it is depending on Firebase?
  • Douglas Marques
    Douglas Marques over 5 years
    Same issue! I would like to ignore the warning. How can I do it?
  • behelit
    behelit over 5 years
    I'm pretty sure he/she is saying that they don't want to add the core dependency as they aren't even using it, so why would adding it be a solution?
  • Warren
    Warren over 5 years
    Which file do we add this line to and where in the file?
  • Androidcoder
    Androidcoder almost 5 years
    If I try to upgrade firebase.core to anything higher than 16.0.9, I get a compile killing merge error with support-v4, so have had to leave it at 16.0.9. I'm not geek enough to fix the error from the support-v4 end so may have to just drop analytics. Attempting to upgrade .auth and .database from 17.0.0 also causes the merge error.
  • Faisal
    Faisal about 4 years
    This does not answer the question in hand.