A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://firebase.google.com/docs/android/setup below:

Add Firebase to your Android project

Skip to main content Add Firebase to your Android project

Stay organized with collections Save and categorize content based on your preferences.

Prerequisites

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: 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.

Create a Firebase project

  1. In the Firebase console, click Add project.

  2. If prompted, review and accept the Firebase terms.

  3. Click Continue.

  4. (Optional) Set up Google Analytics for your project, which enables an optimal experience using the following Firebase products: Firebase A/B Testing, Cloud Messaging, Crashlytics, In-App Messaging, and Remote Config (including Personalization).

    Either select an existing Google Analytics account or create a new account. If you create a new account, select your Analytics reporting location, then accept the data sharing settings and Google Analytics terms for your project.

    You can always set up Google Analytics later in the Integrations tab of your settings Project settings.
  5. Click Create project (or Add Firebase, if you're adding Firebase to an existing Google Cloud project).

Firebase automatically provisions resources for your Firebase project. When the process completes, you'll be taken to the overview page for your Firebase project in the Firebase console.

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.

Note: Check out our best practices for adding apps to a Firebase project, including how to handle multiple variants.
  1. Go to the Firebase console.

  2. In the center of the project overview page, click the Android icon (plat_android) or Add app to launch the setup workflow.

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

    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.

    Make sure to enter the package name that your app is actually using. 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.
  4. (Optional) Enter other app information: App nickname and Debug signing certificate SHA-1.

    How are the App nickname and the Debug signing certificate SHA-1 used within Firebase?

  5. Click Register app.

Step 3: Add a Firebase configuration file
  1. Download and then add your app's Firebase config file (google-services.json) to your codebase:

    1. Click Download google-services.json to obtain your app's Firebase config file.

    2. Move your config file into the module (app-level) root directory of your app.

    What do you need to know about this config file?

    • The Firebase config file contains unique, but non-secret identifiers for your project and app. To learn more about this config file, visit Understand Firebase Projects.

    • You can download your Firebase config file again at any time.

    • Make sure the config file name is not appended with additional characters, like (2).

  2. To make the values in your google-services.json config file accessible to Firebase SDKs, you need the Google services Gradle plugin (google-services).

    1. In your root-level (project-level) Gradle file (<project>/build.gradle.kts or <project>/build.gradle), add the Google services plugin as a dependency:

      Kotlin Are you still using the buildscript syntax? Learn how to add Firebase plugins using that syntax.
      plugins {
        id("com.android.application") version "7.3.0" apply false
        // ...
      
        // Add the dependency for the Google services Gradle plugin
        id("com.google.gms.google-services") version "4.4.3" apply false
      }
      Groovy Are you still using the buildscript syntax? Learn how to add Firebase plugins using that syntax.
      plugins {
        id 'com.android.application' version '7.3.0' apply false
        // ...
      
        // Add the dependency for the Google services Gradle plugin
        id 'com.google.gms.google-services' version '4.4.3' apply false
      }
    2. In your module (app-level) Gradle file (usually <project>/<app-module>/build.gradle.kts or <project>/<app-module>/build.gradle), add the Google services plugin:

      Kotlin
      plugins {
        id("com.android.application")
      
        // Add the Google services Gradle plugin
        id("com.google.gms.google-services")
        // ...
      }
      Groovy
      plugins {
        id 'com.android.application'
      
        // Add the Google services Gradle plugin
        id 'com.google.gms.google-services'
        // ...
      }
Step 4: Add Firebase SDKs to your app
  1. In your module (app-level) Gradle file (usually <project>/<app-module>/build.gradle.kts or <project>/<app-module>/build.gradle), add the dependencies for the Firebase products that you want to use in your app. We recommend using the Firebase Android BoM to control library versioning.

    Analytics enabled
    dependencies {
      // ...
    
      // Import the Firebase BoM
      implementation(platform("com.google.firebase:firebase-bom:33.16.0"))
    
      // When using the BoM, you don't specify versions in Firebase library dependencies
    
      // Add the dependency for the Firebase SDK for Google Analytics
      implementation("com.google.firebase:firebase-analytics")
    
      // TODO: Add the dependencies for any other Firebase products you want to use
      // See https://firebase.google.com/docs/android/setup#available-libraries
      // For example, add the dependencies for Firebase Authentication and Cloud Firestore
      implementation("com.google.firebase:firebase-auth")
      implementation("com.google.firebase:firebase-firestore")
    }

    By using the Firebase Android BoM, your app will always use compatible versions of Firebase Android libraries.

    Looking for a Kotlin-specific library module? Starting in October 2023 (Firebase BoM 32.5.0), both Kotlin and Java developers can depend on the main library module (for details, see the FAQ about this initiative).

    Analytics not enabled
    dependencies {
      // ...
    
      // Import the Firebase BoM
      implementation(platform("com.google.firebase:firebase-bom:33.16.0"))
    
      // When using the BoM, you don't specify versions in Firebase library dependencies
    
      // TODO: Add the dependencies for Firebase products you want to use
      // See https://firebase.google.com/docs/android/setup#available-libraries
      // For example, add the dependencies for Firebase Authentication and Cloud Firestore
      implementation("com.google.firebase:firebase-auth")
      implementation("com.google.firebase:firebase-firestore")
    }

    By using the Firebase Android BoM, your app will always use compatible versions of Firebase Android libraries.

    Looking for a Kotlin-specific library module? Starting in October 2023 (Firebase BoM 32.5.0), both Kotlin and Java developers can depend on the main library module (for details, see the FAQ about this initiative).

  2. After adding the dependencies for the products you want to use, sync your Android project with Gradle files.

    Are you getting a build failure about invoke-custom support and enabling desugaring? Here's how to fix it.

    Gradle builds that use Android Gradle plugin (AGP) v4.2 or earlier need to enable Java 8 support. Otherwise, these Android projects get a build failure when adding a Firebase SDK.

    To fix this build failure, you can follow one of two options:

    • Add the listed compileOptions from the error message to your app-level build.gradle.kts or build.gradle file.
    • Increase the minSdk for your Android project to 26 or above.

    Learn more about this build failure in this FAQ.

That's it! You can skip ahead to check out the recommended next steps.

If you're having trouble getting set up, though, visit the Android troubleshooting & FAQ.

Option 2: Add Firebase using the Firebase Assistant

The Firebase Assistant registers your app with a Firebase project and adds the necessary Firebase files, plugins, and dependencies to your Android project — all from within Android Studio!

  1. Open your Android project in Android Studio, then make sure that you're using the latest versions of Android Studio and the Firebase Assistant:

  2. Open the Firebase Assistant: Tools > Firebase.

  3. In the Assistant pane, choose a Firebase product to add to your app. Expand its section, then click the tutorial link (for example, Analytics > Log an Analytics event).

    1. Click Connect to Firebase to connect your Android project with Firebase.

      What does this workflow do?

      • This workflow automatically creates a new Firebase Android app using your app's package name. You can create this new Firebase Android app in either an existing Firebase project or a new project.

        Here are some tips about setting up your Firebase project:

        • Check out our best practices for adding apps to a Firebase project, including how to handle multiple variants.

        • If you create a new project, we strongly recommend that you set up Google Analytics for your project, which enables you to have an optimal experience using many Firebase products.

      • This workflow also adds your Firebase project's Android configuration file (google-services.json) to the module (app-level) directory of your app.

        Note: The Firebase config file contains unique, but non-secret identifiers for your project.
        Visit Understand Firebase Projects to learn more about this config file.
    2. Click the button to add a desired Firebase product (for example, Add Analytics to your app).

  4. Sync your app to ensure that all dependencies have the necessary versions.

  5. In the Assistant pane, follow the remaining setup instructions for your selected Firebase product.

  6. Add as many other Firebase products as you'd like via the Firebase Assistant!

Do you want an easier way to manage library versions?
You can use the Firebase Android BoM to manage your Firebase library versions and ensure that your app is always using compatible library versions.

That's it! Make sure to check out the recommended next steps.

If you're having trouble getting set up, though, visit the Android troubleshooting & FAQ.

Available libraries

This section lists the Firebase products supported for Android and their Gradle dependencies. Learn more about these Firebase Android libraries:

Note that when using the Firebase Android BoM, you don't specify individual library versions when you declare Firebase library dependencies in your Gradle build configuration file.

Important: Kotlin developers should now depend on the main modules instead of the KTX modules (when using Firebase BoM v32.5.0+ or main module versions listed in BoM v32.5.0+). For details, see the FAQ about this initiative.

The main section of the table below lists the dependencies for the main modules and their latest versions. If needed, though, you can still find a list of all KTX modules and their versions at the bottom of the table.

1 Firebase AI Logic was formerly called "Vertex AI in Firebase" with the package com.google.firebase:firebase-vertexai.

Next steps

Add Firebase services to your app:

Learn about Firebase:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-10 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-10 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4