Add Firebase to your Android project Stay organized with collections Save and categorize content based on your preferences.
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 latercompileSdkVersion
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).
- Sign into theFirebase console.
- Click the button to create a new Firebase project.
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.- If prompted, review and accept theFirebase terms, then clickContinue.
- (Optional) Enable AI assistance in theFirebase console (called "Gemini in Firebase"), which can help you get started and streamline your development process.
(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 your Project settings.- 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.
- Sign into theFirebase console with the account that gives you access to the existingGoogle Cloud project.
- Click the button to create a new Firebase project.
- At the bottom of the page, clickAdd Firebase to Google Cloud project.
- In the text field, start entering theproject name of the existing project, and then select the project from the displayed list.
- ClickOpen project.
- If prompted, review and accept theFirebase terms, then clickContinue.
- (Optional) Enable AI assistance in theFirebase console (called "Gemini in Firebase"), which can help you get started and streamline your development process.
(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 your Project settings.- 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.Go to theFirebase console.
In the center of the project overview page, click theAndroid icon(
)orAdd app to launch the setup workflow.Enter your app's package name in theAndroid package name field.
What's a package name, and where do you find it?
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.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,usually
app/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.
(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?
App nickname: An internal, convenience identifier that is onlyvisible to you in theFirebase console
Debug signing certificate SHA-1: ASHA-1hash is required byFirebase Authentication (when usingGoogle Sign In orphone number sign in) andFirebase Dynamic Links.
ClickRegister app.
Step 3: Add a Firebase configuration file
Download and then add your app's Firebase config file(
) to your codebase:google-services.json ClickDownload google-services.json to obtain your app's Firebaseconfig file.
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)
.
To make the values in your
config file accessibleto Firebase SDKs, you need theGoogle services Gradle plugin (google-services.json google-services
).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 thebuildscript
syntax? 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 thebuildscript
syntax? 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}
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
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.
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 listed
compileOptions
from the error message to yourapp-levelbuild.gradle.kts
orbuild.gradle
file. - Increase the
minSdk
for your Android project to 26 or above.
Learn more about this build failure inthis FAQ.
- Add the listed
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!
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
Open the Firebase Assistant:Tools > Firebase.
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 ).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 (
Note: The Firebase config file contains unique, but non-secretidentifiers for your project.
) to the module(app-level) directory of your app.google-services.json
VisitUnderstand FirebaseProjects to learnmore about this config file.
Click the button to add a desired Firebase product (for example,
AddAnalytics to your app ).
Sync your app to ensure that all dependencies have the necessary versions.
In theAssistant pane, follow the remaining setup instructions for yourselected Firebase product.
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 theFirebase 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:
Firebase Android SDKGitHub repo
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 Product | Gradle dependency | Latest 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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AdMob | com.google.android.gms:play-services-ads | 24.6.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Firebase AI Logic1 | com.google.firebase:firebase-ai | 17.3.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Analytics | com.google.firebase:firebase-analytics | 23.0.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
App Check custom provider | com.google.firebase:firebase-appcheck | 19.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
App Check debug provider | com.google.firebase:firebase-appcheck-debug | 19.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
App Check Play Integrity provider | com.google.firebase:firebase-appcheck-playintegrity | 19.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
App Distribution | com.google.firebase:firebase-appdistribution | 16.0.0-beta17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
App Distribution API | com.google.firebase:firebase-appdistribution-api | 16.0.0-beta17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
App Distribution plugin | com.google.firebase:firebase-appdistribution-gradle | 5.1.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Authentication | com.google.firebase:firebase-auth | 24.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cloud Firestore | com.google.firebase:firebase-firestore | 26.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cloud Functions for Firebase Client SDK | com.google.firebase:firebase-functions | 22.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cloud Messaging | com.google.firebase:firebase-messaging | 25.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cloud Storage | com.google.firebase:firebase-storage | 22.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Crashlytics | com.google.firebase:firebase-crashlytics | 20.0.2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Crashlytics NDK | com.google.firebase:firebase-crashlytics-ndk | 20.0.2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Crashlytics plugin | com.google.firebase:firebase-crashlytics-gradle | 3.0.6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Data Connect | com.google.firebase:firebase-dataconnect | 17.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Dynamic feature module support | com.google.firebase:firebase-dynamic-module-support | 16.0.0-beta04 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In-App Messaging | com.google.firebase:firebase-inappmessaging | 22.0.1 | (required) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In-App Messaging Display | com.google.firebase:firebase-inappmessaging-display | 22.0.1 | (required) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Firebase installations | com.google.firebase:firebase-installations | 19.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Firebase ML Model Downloader API | com.google.firebase:firebase-ml-modeldownloader | 26.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Performance Monitoring | com.google.firebase:firebase-perf | 22.0.2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Performance Monitoring plugin | com.google.firebase:perf-plugin | 2.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Realtime Database | com.google.firebase:firebase-database | 22.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Remote Config | com.google.firebase:firebase-config | 23.0.1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Google Play services plugin | com.google.gms:google-services | 4.4.3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DEPRECATED OR UNSUPPORTED LIBRARIES | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
App Indexing | com.google.firebase:firebase-appindexing | 20.0.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Dynamic Links | com.google.firebase:firebase-dynamic-links | 22.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.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Firebase ML Kit libraries
|
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:
Build generative AI features withGemini andImagen modelsusingFirebase AI Logic.
Gain insights on user behavior withAnalytics.
Set up a user authentication flow withAuthentication.
Store data, like user information, withCloud Firestore orRealtime Database.
Store files, like photos and videos, withCloud Storage.
Trigger backend code that runs in a secure environment withCloud Functions.
Send notifications withCloud Messaging.
Find out when and why your app is crashing withCrashlytics.
Learn about Firebase:
VisitUnderstand Firebase Projects to learn moreabout Firebase projects and best practices for projects.
VisitLearn more about Android and Firebase if youhave questions about concepts that are unfamiliar or specific to Firebase andAndroid development.
Exploresample Firebase apps.
Get hands-on experience with theFirebase AndroidCodelab.
Learn more with theFirebase in a Weekend course.
Prepare to launch your app:
- Set upbudgetalertsfor your project in theGoogle Cloud console.
- Monitor theUsage and billingdashboard in theFirebase console to get an overall picture of your project'susage across multiple Firebase services.
- Review theFirebase launch checklist.
Having trouble with Firebase and your Android project?Visit theAndroid troubleshooting & FAQ.
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.