Is `firebase-core` required for Firebase on Android?
UPDATE: AUGUST 2019
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.
Comments
-
Jeff about 2 years
As far as I know, individual Firebase libraries like
firebase-auth
didn't used to require me to includefirebase-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 almost 6 yearsI'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 almost 6 yearsFirebaser 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 ツ 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 ツ 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 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 almost 6 yearsYou can ignore the warning with FCM, but it will stop some reporting of messaging open stats etc. in some cases.
-
racs over 5 yearsBut 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 over 5 yearsSame issue! I would like to ignore the warning. How can I do it?
-
behelit over 5 yearsI'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 over 5 yearsWhich file do we add this line to and where in the file?
-
Androidcoder almost 5 yearsIf 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 about 4 yearsThis does not answer the question in hand.