If you don’t have an Android Studio project already, you can download one of our quickstart samples if you just want to try a Firebase feature. If you’re using a quickstart, remember to get the package name from the ApplicationManifest.xml, you’ll need it for the next step.

Add Firebase to your app

It’s time to add Firebase to your app. To do this you’ll need a Firebase project and a Firebase configuration file for your app.

Create a Firebase project in the Firebase console, if you don’t already have one. If you already have an existing Google project associated with your mobile app, click Import Google Project. Otherwise, clickCreate New Project.

Click Add Firebase to your Android app and follow the setup steps. If you’re importing an existing Google project, this may happen automatically and you can just download the config file.

When prompted, enter your app’s package name. It’s important to enter the package name your app is using; this can only be set when you add an app to your Firebase project.

At the end, you’ll download a google-services.json file. You can download this file again at any time.

If you haven’t done so already, copy this into your project’s module folder, typically app/.

Note: If you have multiple build variants with different package names defined, each app must be added to your project in Firebase console.

Add the SDK

If you would like to integrate the Firebase libraries into one of your own projects, you need to perform a few basic tasks to prepare your Android Studio project. You may have already done this as part of adding Firebase to your app.

First, add rules to your root-level build.gradle file, to include the google-services plugin: