Add Firebase to your Android project

Prerequisites

  • Install or updateAndroid Studio to its latest version.

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

    • Targets API level 21 (Lollipop)or higher
    • Uses Android 5.0 or higher
    • UsesJetpack (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 anemulator torun your app.
    Note thatFirebase SDKs with a dependency on Google Playservices require the device oremulator to have Google Play services installed.

  • Sign into Firebase using your Googleaccount.

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


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

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



Option 1: Add Firebase using theFirebase console

Adding Firebase to your app involves tasks both in theFirebase console andin your open Android project (for example, you download Firebase config filesfrom 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 Firebaseproject to connect to your Android app. VisitUnderstand Firebase Projects to learn more aboutFirebase projects.

View instructions to create a Firebase project

New to Firebase or Cloud

Follow these steps if you're new to Firebase orGoogle Cloud.
You can also follow these steps if you want to create a wholly new Firebase project (and its underlyingGoogle Cloud project).

  1. Sign into theFirebase console.
  2. Click the button to create a new Firebase project.
  3. In the text field, enter aproject name.

    If you're part of aGoogle Cloud org, you can optionally select which folder you create your project in.

    Your project name is used as a display name in Firebase interfaces, and Firebase auto-creates a unique project ID based on this project name. Note that you can optionally click theEdit icon now to set your preferred project ID, but you cannot change this ID after project creation. Learn abouthow Firebase uses the project ID.
  4. If prompted, review and accept theFirebase terms, then clickContinue.
  5. (Optional) Enable AI assistance in theFirebase console (called "Gemini in Firebase"), which can help you get started and streamline your development process.
  6. (Optional) Set upGoogle Analytics for your project, which enables an optimal experience using these Firebase products:Firebase A/B Testing,Cloud Messaging,Crashlytics,In-App Messaging, andRemote Config (includingPersonalization).

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

    You can always set upGoogle Analytics later in theIntegrations tab of yourProject settings.
  7. ClickCreate project.

Firebase creates your project, provisions some initial resources, and enables important APIs. When the process completes, you'll be taken to the overview page for your Firebase project in theFirebase console.

Existing Cloud project

Follow these steps if you want to start using Firebase with an existingGoogle Cloud project. Learn more about"adding Firebase" to an existingGoogle Cloud project.

  1. Sign into theFirebase console with the account that gives you access to the existingGoogle Cloud project.
  2. Click the button to create a new Firebase project.
  3. At the bottom of the page, clickAdd Firebase to Google Cloud project.
  4. In the text field, start entering theproject name of the existing project, and then select the project from the displayed list.
  5. ClickOpen project.
  6. If prompted, review and accept theFirebase terms, then clickContinue.
  7. (Optional) Enable AI assistance in theFirebase console (called "Gemini in Firebase"), which can help you get started and streamline your development process.
  8. (Optional) Set upGoogle Analytics for your project, which enables an optimal experience using these Firebase products:Firebase A/B Testing,Cloud Messaging,Crashlytics,In-App Messaging, andRemote Config (includingPersonalization).

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

    You can always set upGoogle Analytics later in theIntegrations tab of yourProject settings.
  9. ClickAdd Firebase.

Firebaseadds Firebase to your existing project. When the process completes, you'll be taken to the overview page for your Firebase project in theFirebase console.

Step 2: Register your app with Firebase

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

Note: Check out ourbest practicesfor adding apps to a Firebase project, including how to handle multiplevariants.
  1. Go to theFirebase console.

  2. In the center of the project overview page, click theAndroid icon()orAdd app to launch the setup workflow.

  3. Enter your app's package name in theAndroid package name field.

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

    • Apackagename uniquely identifies your app on the device and in the Google Play Store.

    • Apackage name is often referred to as anapplication ID.

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

    • Be aware that the package name value is case-sensitive, and it cannot bechanged for this Firebase Android app after it's registered with yourFirebase 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 andDebug signing certificate SHA-1.

    How are theApp nickname and theDebug signing certificate SHA-1 used within Firebase?

  5. ClickRegister 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. ClickDownload google-services.json to obtain your app's Firebaseconfig file.

    2. Move your config file into themodule (app-level) root directory ofyour app.

    What do you need to know about this config file?

    • The Firebase config file contains unique, but non-secret identifiers foryour project and app. To learn more about this config file, visitUnderstand FirebaseProjects.

    • You can download yourFirebase configfile again at any time.

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

  2. To make the values in yourgoogle-services.json config file accessibleto Firebase SDKs, you need theGoogle services Gradle plugin (google-services).

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

      Kotlin

      Are you still using thebuildscriptsyntax? Learn how toadd Firebase pluginsusing that syntax.
      plugins{id("com.android.application")version"7.3.0"applyfalse// ...// Add the dependency for the Google services Gradle pluginid("com.google.gms.google-services")version"4.4.3"applyfalse}

      Groovy

      Are you still using thebuildscriptsyntax? Learn how toadd Firebase pluginsusing that syntax.
      plugins{id'com.android.application'version'7.3.0'applyfalse// ...// Add the dependency for the Google services Gradle pluginid'com.google.gms.google-services'version'4.4.3'applyfalse}
    2. In yourmodule (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 pluginid("com.google.gms.google-services")// ...}

      Groovy

      plugins{id'com.android.application'// Add the Google services Gradle pluginid'com.google.gms.google-services'// ...}

Step 4: Add Firebase SDKs to your app

  1. In yourmodule (app-level) Gradle file(usually<project>/<app-module>/build.gradle.kts or<project>/<app-module>/build.gradle),add the dependencies for theFirebase productsthat you want to use in your app. We recommend using theFirebase Android BoM to controllibrary versioning.

    Analytics enabled

    dependencies{// ...// Import theFirebase BoMimplementation(platform("com.google.firebase:firebase-bom:34.3.0"))// When using theBoM, you don't specify versions in Firebase library dependencies// Add the dependency for the Firebase SDK for Google Analyticsimplementation("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 forFirebase Authentication andCloud Firestoreimplementation("com.google.firebase:firebase-auth")implementation("com.google.firebase:firebase-firestore")}

    By using theFirebase Android BoM,your app will always use compatible versions of Firebase Androidlibraries.

    Analytics not enabled

    dependencies{// ...// Import theFirebase BoMimplementation(platform("com.google.firebase:firebase-bom:34.3.0"))// When using theBoM, 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 forFirebase Authentication andCloud Firestoreimplementation("com.google.firebase:firebase-auth")implementation("com.google.firebase:firebase-firestore")}

    By using theFirebase Android BoM,your app will always use compatible versions of Firebase Androidlibraries.

  2. After adding the dependencies for the products you want to use, sync yourAndroid 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 toenable Java 8 support. Otherwise, these Android projects get a buildfailure when adding a Firebase SDK.

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

    • Add the listedcompileOptions from the error message to yourapp-levelbuild.gradle.kts orbuild.gradle file.
    • Increase theminSdk for your Android project to 26 or above.

    Learn more about this build failure inthis FAQ.

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

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



Option 2: Add Firebase using the Firebase Assistant

TheFirebase Assistant registersyour 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'reusing the latest versions of Android Studio and the Firebase Assistant:

    • Windows / Linux:Help > Check for updates
    • macOS:Android Studio > Check for updates
  2. Open the Firebase Assistant:Tools > Firebase.

  3. In theAssistant 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. ClickConnect to Firebase to connect your Android project with Firebase.

      What does this workflow do?

      • This workflow automatically creates a new Firebase Android app usingyour app'spackage name.You can create this new Firebase Android app in either an existingFirebase project or a new project.

        Here are some tips about setting up your Firebase project:

        • Check out ourbest practicesfor adding apps to a Firebase project, including how to handlemultiple variants.

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

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

        Note: The Firebase config file contains unique, but non-secretidentifiers for your project.
        Visit
        Understand FirebaseProjects to learnmore about this config file.

    2. Click the button to add a desired Firebase product (for example,AddAnalytics to your app).

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

  5. In theAssistant pane, follow the remaining setup instructions for yourselected Firebase product.

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

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 recommendednext steps.

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



Available libraries

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

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

Important:Kotlin developers should now depend on the main modules instead of the KTX modules (when usingFirebase BoM v32.5.0+ or main module versions listed inBoM v32.5.0+). InJuly 2025, we stopped releasing new versions of the KTX modules, and we removed the KTX libraries from theFirebase Android BoM (v34.0.0). For details, see theFAQ about this initiative.
Service or ProductGradle dependencyLatest
version
AddAnalytics?
Firebase Android BoM
(Bill of Materials)
com.google.firebase:firebase-bom

The latestFirebase BoM version contains the latest versions of each Firebase Android library. To learn which library versions are mapped to a specificBoM version, review the release notes for thatBoM version.

34.3.0
AdMobcom.google.android.gms:play-services-ads24.6.0
Firebase AI Logic1com.google.firebase:firebase-ai17.3.0
Analyticscom.google.firebase:firebase-analytics23.0.0
App Check custom providercom.google.firebase:firebase-appcheck19.0.1
App Check debug providercom.google.firebase:firebase-appcheck-debug19.0.1
App Check Play Integrity providercom.google.firebase:firebase-appcheck-playintegrity19.0.1
App Distributioncom.google.firebase:firebase-appdistribution16.0.0-beta17
App Distribution APIcom.google.firebase:firebase-appdistribution-api16.0.0-beta17
App Distribution plugincom.google.firebase:firebase-appdistribution-gradle5.1.1
Authenticationcom.google.firebase:firebase-auth24.0.1
Cloud Firestorecom.google.firebase:firebase-firestore26.0.1
Cloud Functions for Firebase Client SDKcom.google.firebase:firebase-functions22.0.1
Cloud Messagingcom.google.firebase:firebase-messaging25.0.1
Cloud Storagecom.google.firebase:firebase-storage22.0.1
Crashlyticscom.google.firebase:firebase-crashlytics20.0.2
Crashlytics NDKcom.google.firebase:firebase-crashlytics-ndk20.0.2
Crashlytics plugincom.google.firebase:firebase-crashlytics-gradle3.0.6
Data Connectcom.google.firebase:firebase-dataconnect17.0.1
Dynamic feature module supportcom.google.firebase:firebase-dynamic-module-support16.0.0-beta04
In-App Messagingcom.google.firebase:firebase-inappmessaging22.0.1
(required)
In-App Messaging Displaycom.google.firebase:firebase-inappmessaging-display22.0.1
(required)
Firebase installationscom.google.firebase:firebase-installations19.0.1
Firebase ML Model Downloader APIcom.google.firebase:firebase-ml-modeldownloader26.0.1
Performance Monitoringcom.google.firebase:firebase-perf22.0.2
Performance Monitoring plugincom.google.firebase:perf-plugin2.0.1
Realtime Databasecom.google.firebase:firebase-database22.0.1
Remote Configcom.google.firebase:firebase-config23.0.1
Google Play services plugincom.google.gms:google-services4.4.3
DEPRECATED OR UNSUPPORTED LIBRARIES
App Indexingcom.google.firebase:firebase-appindexing20.0.0
Dynamic Linkscom.google.firebase:firebase-dynamic-links22.1.0

Firebase KTX modules - no longer supported

InJuly 2025, we stopped releasing new versions of KTX modules for Firebase libraries, and we removed the KTX libraries from theFirebase Android BoM (v34.0.0).

If you use KTX APIs from the previously released KTX modules, we strongly recommend that youmigrate your app to use KTX APIs from the main modules instead. For details, see theFAQ about this initiative.

AnalyticsDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-analytics-ktx
22.5.0
App Check custom providerDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-appcheck-ktx
18.0.0
App Distribution APIDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-appdistribution-api-ktx
16.0.0-beta15
AuthenticationDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-auth-ktx
23.2.1
Cloud FirestoreDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-firestore-ktx
25.1.4
Cloud Functions for Firebase Client SDKDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-functions-ktx
21.2.1
Cloud MessagingDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-messaging-ktx
24.1.2
Cloud StorageDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-storage-ktx
21.0.2
CrashlyticsDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-crashlytics-ktx
19.4.4
Dynamic LinksDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-dynamic-links-ktx
22.1.0
In-App MessagingDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-inappmessaging-ktx
21.0.2
(required)
In-App Messaging DisplayDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-inappmessaging-display-ktx
21.0.2
(required)
Firebase installationsDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-installations-ktx
18.0.0
Firebase ML Model Downloader APIDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-ml-modeldownloader-ktx
25.0.1
Performance MonitoringDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-perf-ktx
21.0.5
Realtime DatabaseDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-database-ktx
21.0.0
Remote ConfigDo not use; KTX module libraries are no longer supported.
com.google.firebase:firebase-config-ktx
22.1.2

Firebase ML Kit libraries

Firebase ML Custom Model APIscom.google.firebase:firebase-ml-model-interpreter22.0.4
Firebase ML Vision APIscom.google.firebase:firebase-ml-vision24.1.0
Firebase ML: Image Labeling Modelcom.google.firebase:firebase-ml-vision-image-label-model20.0.2
Firebase ML: Object Detection and Tracking Modelcom.google.firebase:firebase-ml-vision-object-detection-model19.0.6
Firebase ML: Face Detection Modelcom.google.firebase:firebase-ml-vision-face-model20.0.2
Firebase ML: Barcode Scanning Modelcom.google.firebase:firebase-ml-vision-barcode-model16.1.2
Firebase ML: AutoML Vision Edge APIcom.google.firebase:firebase-ml-vision-automl18.0.6
Firebase ML: Natural Language APIscom.google.firebase:firebase-ml-natural-language22.0.1
Firebase ML: Language Identification Modelcom.google.firebase:firebase-ml-natural-language-language-id-model20.0.8
Firebase ML: Translate Modelcom.google.firebase:firebase-ml-natural-language-translate-model20.0.9
Firebase ML: Smart Reply Modelcom.google.firebase:firebase-ml-natural-language-smart-reply-model20.0.8

1Firebase AI Logic was formerly called "Vertex AI in Firebase" with the packagecom.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 theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-01 UTC.