1

here is the screenshot i want to run a project in android studio. but when i click run button it's showing me the error

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

Molly
  • 1,887
  • 3
  • 17
  • 34
Mahdi Hasan
  • 13
  • 1
  • 6

1 Answers1

1

As the warning is clearly stating, you're trying to use a library that needs firebase-core to work. Basically all Firebase plugins need to have the Firebase core library added for them to work.

To fix your problem add the library to your App build.gradle file:

implementation 'com.google.firebase:firebase-core:16.0.6'

When adding a new App to your Firebase Console you need to follow the steps as below:

enter image description here

113408
  • 3,364
  • 6
  • 27
  • 54
  • Not all firebase libs need to have core in graddle. for example if you want to just use auth plugin you just use it like `com.google.firebase:firebase-auth:16.1.0` – rgaraisayev Jan 26 '19 at 11:08
  • @rgaraisayev when you add a new App to your Firebase Console, the 3rd step asks you to clearly add the `core` library. – 113408 Jan 26 '19 at 11:11
  • This is general information. And it is not recommended to add core to gradle if you are going to use a few plugins. You must add what you need, otherwise your method count will rocket, then you will need to use multidexing – rgaraisayev Jan 26 '19 at 11:17
  • To address your specific question, `firebase-auth` requires `firebase-core` as stated by official doc : https://support.google.com/firebase/answer/6383877?hl=en#features – 113408 Jan 26 '19 at 11:21
  • I say it is not required, but you still arguing. I have working project that uses auth plugin in front of me, and there is not core dependency explicitly defined in gradle. Calm down – rgaraisayev Jan 26 '19 at 11:32
  • As 113408 mentioned, u should add the core library ! – ismail alaoui Jan 26 '19 at 11:39