Add Firebase to your Android project

Prerequisites

  • Install or update Android Studio to its latest version.

  • Make sure that your project meets these requirements (note that some products might have stricter requirements):

    • Targets API level 21 (Lollipop) or higher
    • Uses Android 5.0 or higher
    • Uses Jetpack (AndroidX) , which includes meeting these version requirements:
      • com.android.tools.build:gradle v7.3.0 or later
      • compileSdkVersion 28 or later
  • Set up a physical device or use an emulator to run your app.Note that Firebase SDKs with a dependency on Google Play services require the device or emulator to have Google Play services installed.

  • Sign into Firebase using your Google account.

If you don't already have an Android project and just want to try out a Firebase product, you can download one of our quickstart samples .


You can connect your Android app to Firebase using one of the following options:

  • Option 1 : (recommended) Use the Firebase console setup workflow.
  • Option 2 : Use the Android Studio Firebase Assistant (may require additional configuration).



Option 1: Add Firebase using the Firebase console

Adding Firebase to your app involves tasks both in the Firebase console and in your open Android project (for example, you download Firebase config files from the console, then move them into your Android project).

Step 1: Create a Firebase project

Before you can add Firebase to your Android app, you need to create a Firebase project to connect to your Android app. Visit Understand Firebase Projects to learn more about Firebase projects.

Step 2: Register your app with Firebase

To use Firebase in your Android app, you need to register your app with your Firebase project. Registering your app is often called "adding" your app to your project.

  1. Go to the Firebase console .

  2. In the center of the project overview page, click the Androidicon ( ) or Add appto launch the setup workflow.

  3. Enter your app's package name in the Android package namefield.

    What's a package name, and where do you find it?

    • A package name uniquely identifies your app on the device and in the Google Play Store.

    • A package name is often referred to as an application ID .

    • Find your app's package name in your module (app-level) Gradle file, usually app/build.gradle (example package name: com.yourcompany.yourproject ).

    • Be aware that the package name value is case-sensitive, and it cannot be changed for this Firebase Android app after it's registered with your Firebase project.