How to connect Android App to Firebase
How to connect Android App to Firebase
What is Firebase ?
Firebase is a platform backed by Google which offers a range of products that can help you build better apps, improve app quality and grow your business.
Products offered by Firebase are listed below :
- Cloud Firestore: Store and sync app data on a global scale.
- ML Kit: Machine learning for mobile developers.
- Cloud Functions: Run mobile backend code without managing servers. To know more click here.
- Authentication: Authenticate users simply and securely.
- Hosting: Deliver web app assets with speed and security.
- Cloud Storage: Store and serve files at Cloud without worrying about scalability.
- Realtime Database: Store your app data and sync them in seconds.
- Crashlytics: Prioritize and fix issues with powerful, realtime crash reporting.
- Performance Monitoring: Gain insight into your app’s performance.
- Test lab: Test your app on devices hosted by Google.
- App Distribution: Distribute pre-release versions of your app to your trusted testers.
- In-app Messaging: Engage active app users with contextual messages.
- Google Analytics: Get free and unlimited app analytics.
- Predictions: Smart user segmentation based on predicted behavior.
- A/B Testing: Optimize your app experience through experimentation.
- Cloud Messaging: Send targeted messages and notifications.
- Remote Config: Modify your app without deploying a new version to Playstore.
- Dynamic Links: Drive growth by using deep links with attribution.
Connect an Android app to FireBase
Step 1
Open Firebase Console and click on Add Project.

Step 2
Enter your project name, check the user agreement and click on Continue.

Step 3
Make sure the option Enable Google Analytics for this project is enabled. Click Continue.

Step 4
On the Configure Google Analytics screen, select Default Account for Firebase from the dropdown and click Create project.

Step 5
Now, click on the Android icon to proceed with adding your Android app to this Firebase project.

Step 6
Enter the package name of your app and click on Register app.

Step 7
Click on the Download google-services.json button and once the JSON file gets downloaded, place it inside the app folder of your Android project.

Step 8
Click on next and it will show you the dependencies that you need to add to your Android project.

Copy the dependency marked with number 1 to your project level build.gradle file and copy the dependencies marked with number 2 and 3 to your app level build.gradle file as shown in the screenshots below.


Finally, click on Sync Now in the bar that appears in Android Studio.
Step 9
Click on the Next button and then select the Skip this step option. Congratulations, your Android app is now connected to the Firebase.