Add Firebase To your Flutter Project 2021 (Android)
Step-1
Create an Account in Firebase and once its created go to your firebase console
Step-2
In the Firebase Console Click Add Project
Step-3
Enter a project name related to your project and click continue
Step-4
Click Enable google analytics for this project
(Usually, it is on by default)
Then Click Continue
Step-5
Select Default Account for Firebase and click Create Project
Step-6
This is how your console will look once previous steps are done
For Android
Click on android (center icon) to connect to your android project
Enter your package name here.
Do not know what is your package name?
Don't worry, go to your project: folder > android > app > build.gradle
Find :
applicationid “copy whatever is here”
and paste as shown below (my flutter project name is android_firebase)
Click Register App
Next, Download the google-services.json file and put it in
android > app (Paste inside app folder)
Next step,
copy this and paste in android > build.gradle
Next step,
copy this and paste in android > app > build.gradle
And inside dependencies add multidex
In the same file do the below step
Enable multidex to true
Final steps:
Add firebase_core package to your dependencies link here and import file to main.dart file
Last,
Edit main.dart file to look like this
Uninstall and Newly Run your app on the emulator and it should be working perfectly
Hope this blog has helped you with enough information on how to connect your Android Project to firebase
IOS project connection coming soon