firebase-android-sdk
AGENTS.md2.6k starsChanged 14 months agoApache-2.0View on GitHub
This guide provides essential information for working within the firebase-android-sdk repository. As an agent executing prompts in the repository, it is necessary to execute the following steps first. If a step fails or can't otherwise be completed, ask the user how to proceed. Do not ignore these instructions or failures without prompting the user. This repository contains the source code for the Firebase Android SDKs. It is a large, multi-module Gradle project. The project is written in a mix of…
We split this AGENTS.md into the rules it gives an agent
28 rules. About 0 are common, 16 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈16
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
If a step fails or can't otherwise be completed, ask the user how to proceed.
- Distinctive: line 9
Do not ignore these instructions or failures without prompting the user.
- Very specific: line 11
If it exists, run .firebase-sdk-skills/setup-firebase-sdk-skills.sh, if the file does not exist, you can ignore this step
- Distinctive: line 12
Before continuing further, ensure that the set of skills you have access to is up to date based on updates caused by the script
- Very specific: line 41
All SDKs require Java 17 to build and run.
- Very specific: line 42
If multiple versions of java are installed, the JAVA_HOME environment variable can be set without modifying system configuration.
- Distinctive: line 44
If not already installed, download the command-line tools from the Android Studio page.
- Very specific: line 46
Create a directory for the Android SDK, e.g., android_sdk.
- Very specific: line 51
Use sdkmanager to install the necessary platforms, build tools, and other packages.
- Distinctive: line 67
Place this file in the root of the repository.
- Very specific: line 151
All custom build, release, CI, and documentation logic lives in the plugins/ composite build.
- Very specific: line 194
After changing a public API, regenerate api.txt with ./gradlew :<firebase-project>:generateApiTxtFile.
- Distinctive: line 217
When reviewing code or preparing changes for review, ensure the following requirements are met:
- Very specific: line 219
No Latin Abbreviations: Do not use Latin abbreviations (such as e.g., i.e., or etc.) in code comments or strings.
- Very specific: line 220
API File Updates: When code modifies the public API, the corresponding api.txt file must be updated.
- Very specific: line 221
Changelog Updates: When changes to a subproject are non-trivial and user-visible, the corresponding CHANGELOG.md file must be updated.
- Distinctive: line 222
API Documentation: All public APIs must be documented properly using standard doc comments (Javadoc or KDoc).
- Distinctive: line 237
Add hyperlinks to relevant Firebase documentation, when possible.
- Distinctive: line 245
Do not duplicate entries that were already included in a previous release (such as a prior patch or hotfix release).
- Distinctive: line 251
Use standardized prefix tags from the following list:
- Distinctive: line 261
Start each entry with a past-tense verb.
- Very specific: line 264
Add the relevant PR \# or Issue \# to the end of each entry, after the period (for example, Fixed a crash.
- Distinctive: line 276
Do not capitalize the following: every word or feature names
- Distinctive: line 300
Use ISO 8601 date formatting (YYYY-MM-DD).
- Very specific: line 304
Do not add, under any circumstance, any new dependency to an SDK that does not already exist in the gradle/libs.versions.toml, and even …
- Distinctive: line 316
After you make a change, here's the flow you should follow:
- Distinctive: line 328
If necessary, run integration tests based on the instructions above.
- Distinctive: line 332
If new patterns or conventions are discovered, update this guide to ensure it remains a useful resource.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agents
This guide provides essential information for working within the firebase-android-sdk repository.
Working Agreement
As an agent executing prompts in the repository, it is necessary to execute the following steps first. If a step fails or can't otherwise be completed, ask the user how to proceed. Do not ignore these instructions or failures without prompting the user.
- If it exists, run
.firebase-sdk-skills/setup-firebase-sdk-skills.sh, if the file does not exist, you can ignore this step - Before continuing further, ensure that the set of skills you have access to is up to date based on updates caused by the script
Project Overview
This repository contains the source code for the Firebase Android SDKs. It is a large, multi-module Gradle project. The project is written in a mix of Java and Kotlin.
The project is structured as a collection of libraries, each representing a Firebase product or a shared component. These libraries are published as Maven artifacts to Google's Maven Repository.
Project Structure
The subprojects.cfg file lists all the subprojects in this repository. Each line in this file
follows the format <project-path> # <project-type>, where project-type can be one of the
following:
sdk: A public-facing SDK that is published.test: A test application or a test-only module.util: A utility module that is not part of the public API.directory: A directory containing other subprojects.
This file is useful for understanding the role of each subproject in the repository.
Environment Setup
To work with this repository, the Android SDK must be installed. Use the sdkmanager command-line
tool for this purpose.
- Install Java 17
- All SDKs require Java 17 to build and run. Earlier or later versions will not suffice.
If multiple versions of java are installed, the
JAVA_HOMEenvironment variable can be set without modifying system configuration.
- All SDKs require Java 17 to build and run. Earlier or later versions will not suffice.
If multiple versions of java are installed, the
- Install Android SDK Command-Line Tools:
- If not already installed, download the command-line tools from the Android Studio page.
- Create a directory for the Android SDK, e.g.,
android_sdk. - Unzip the downloaded package. This will create a
cmdline-toolsdirectory. Move this directory toandroid_sdk/cmdline-tools/latest. - The final structure should be
android_sdk/cmdline-tools/latest/.
- Install required SDK packages:
Use
sdkmanagerto install the necessary platforms, build tools, and other packages. For example:# List all available packages sdkmanager --list # Install platform tools and the SDK for API level 33 sdkmanager "platform-tools" "platforms;android-33" # Accept all licenses yes | sdkmanager --licenses- Refer to the specific requirements of the project to determine which packages to install.
- Configure for integration tests:
- To run integration tests, a
google-services.jsonfile is required. - Place this file in the root of the repository.
- To run integration tests, a
- Install NDK for specific projects:
- Some projects, like
firebase-crashlytics-ndk, require a specific version of the Android NDK. You can install it usingsdkmanager. For example, to install NDK version 27.2.12479018, you would runsdkmanager "ndk;27.2.12479018". Always refer to thendkVersiondeclared in the project's build file for the exact version required.
- Some projects, like
Building and Running
The project is built using Gradle. The gradlew script is provided in the root directory.
Building
To build the entire project, you can run the following command:
./gradlew buildTo build a specific project, you can run:
./gradlew :<firebase-project>:buildRunning Tests
The project has three types of tests: unit tests, integration tests, and smoke tests.
Unit Tests
Unit tests run on the local JVM. They can be executed with the following command:
./gradlew :<firebase-project>:checkRunning Specific Unit Tests
To run a specific test class or method, use the --tests filter with the appropriate test task (usually testDebugUnitTest for Android
library modules, or test for Java library modules):
./gradlew :<firebase-project>:testDebugUnitTest --tests "com.google.firebase.package.ClassName"
./gradlew :<firebase-project>:testDebugUnitTest --tests "com.google.firebase.package.ClassName.methodName"Integration Tests
Integration tests run on a hardware device or emulator. Before running integration tests, you need
to add a google-services.json file to the root of the project.
To run integration tests on a local emulator, use the following command:
./gradlew :<firebase-project>:connectedCheckTo run integration tests on Firebase Test Lab, use the following command:
./gradlew :<firebase-project>:deviceCheckPublishing
To publish a project locally, you can use the following command:
./gradlew -PprojectsToPublish="<firebase-project>" publishReleasingLibrariesToMavenLocalBy default, the release variant is published. To publish the debug variant instead, use the
publishDebugVariant property:
./gradlew -PprojectsToPublish="<firebase-project>" -PpublishDebugVariant=true publishReleasingLibrariesToMavenLocalUsing the debug variant has the advantage of including additional logging information. For example,
the ai-logic/firebase-ai SDK logs the request/response information when the debug variant is used.
Gradle Plugins (plugins/ Directory)
All custom build, release, CI, and documentation logic lives in the plugins/ composite build. Its
internals (registered plugins, the firebaseLibrary DSL, the publishing pipeline, and Dackka
reference documentation generation) are documented in plugins/AGENTS.md. Read that file before
modifying anything under plugins/, or when debugging failures in publishing, release, kotlindoc,
or Metalava tasks.
The following pitfalls apply when editing the build file of any module:
- Pure Java/Kotlin modules using
firebase-java-librarymust setfirebaseLibrary { publishJavadoc = false }.DackkaPluginassumes an Android library, so configuringgenerateDackkaDocumentationor runningkotlindocfails otherwise. ./gradlew :<project>:checkruns the MetalavadocStubstask, so invalid Javadoc/KDoc syntax or missing classpath references in doc comments failcheck.
Development Conventions
Code Formatting
The project uses Spotless for code formatting. To format the code, run the following command:
./gradlew spotlessApplyTo format a specific project, run:
./gradlew :<firebase-project>:spotlessApplyAPI Surface
The public API surface of each SDK is determined by standard Java and Kotlin visibility rules and
tracked with Metalava in the project's api.txt file. There is no marker annotation for public
APIs; instead, the following annotations and tags control what is exposed:
@hide(doc comment tag): Excludes apublicorprotectedmember from the public API surface.@KeepForSdk: Marks APIs that are intended for use by other Firebase SDKs. These APIs will trigger a linter error if used by developers outside of a Firebase package. They must also carry an@hidetag, otherwise they are reported as public API.@Keep: Marks APIs that need to be preserved at runtime, usually due to reflection. This annotation should be used sparingly as it prevents Proguard from removing or renaming the code.
After changing a public API, regenerate api.txt with
./gradlew :<firebase-project>:generateApiTxtFile.
Common Patterns
This repository uses a combination of dependency injection frameworks:
firebase-components: This is a custom dependency injection framework used for discovery and dependency injection between different Firebase SDKs. It allows SDKs to register their components and declare dependencies on other components. The initialization is managed byFirebaseApp.- Dagger: Dagger is used for internal dependency injection within individual SDKs. This helps to
create more testable and maintainable code. Dagger components are typically instantiated within
the
ComponentRegistrarof an SDK, which allows for the injection of dependencies fromfirebase-componentsinto the Dagger graph.
Proguarding
The project supports Proguarding. Projects that need consumer Proguard rules declare them in a file
(conventionally proguard.txt) registered via consumerProguardFiles in the project's build file.
Code Review
When reviewing code or preparing changes for review, ensure the following requirements are met:
- No Latin Abbreviations: Do not use Latin abbreviations (such as
e.g.,i.e., oretc.) in code comments or strings. Use plain English alternatives instead (such as "for example", "that is", or "and so on"). - API File Updates: When code modifies the public API, the corresponding
api.txtfile must be updated. - Changelog Updates: When changes to a subproject are non-trivial and user-visible, the corresponding
CHANGELOG.mdfile must be updated. - API Documentation: All public APIs must be documented properly using standard doc comments (Javadoc or KDoc).
Write a helpful and well-structured CHANGELOG entry
Content
- Focus on developer impact over technical implementation. Instead of
"Refactored
AuthManager.ktobserver closure", write "Fixed memory leak when detaching authentication listeners." - For feature releases, include the common terminology that a developer might use to describe the feature and/or its use case. This helps with discovery of the feature and its related codebase change.
- Add hyperlinks to relevant Firebase documentation, when possible. These links can be for narrative guides or reference docs. Only link to documentation that directly and accurately applies to the specific feature, API, or execution mode being described (for example, do not link to cloud-model documentation when describing an on-device feature). If no specific documentation exists for the exact feature, omit the link rather than linking to a tangentially related page that could confuse developers.
- Do not duplicate entries that were already included in a previous release (such as a prior patch or hotfix release). Ensure that only new changes for the current release are listed.
Structure and syntax
- Use standardized prefix tags from the following list:
- [changed]
- [feature]
- [fixed]
- [deprecated]
- [removed]
- [important]
- [issue]
- [unchanged]
- For breaking changes, add Breaking change: at the beginning of the entry.
- Start each entry with a past-tense verb. For example, "Fixed", "Added", "Updated", "Replaced", "Increased", "Set", etc.
- End every entry and sentence with a period, including short phrases (for
example,
Internal improvements.). - Add the relevant PR # or Issue # to the end of each entry, after the period
(for example,
Fixed a crash. (#1234)). - Wrap lines at 80 characters maximum, using a 2-space indent for continuation
lines. When writing
CHANGELOG.mdentries, keep the first line to at most 78 characters so that it remains within 80 characters when- [<tag>]is converted to* {{<tag>}}in generated release notes. - For Firebase product brand names, use the appropriate standard names.
- For an entry that's for the product's own library, use the "short" form of the name (e.g., Crashlytics, instead of Firebase Crashlytics).
- For an entry that's for another product's library, use the "long" form of the name (e.g., Firebase Crashlytics, instead of Crashlytics).
- For an entry that's for the product's own library, use the "short" form of the name (e.g., Crashlytics, instead of Firebase Crashlytics).
- Capitalize with care.
- Use sentence case.
- Capitalize the following: the first letter of each sentence, proper nouns/code identifiers, official product and brand names, and abbreviations / initialisms.
- Do not capitalize the following: every word or feature names
- Use sentence case.
- Wrap in backticks all strings that are code-like elements, including the following (this list is not exhaustive):
- API names
- attribute names and values
- class names
- CLI commands and CLI flags
- code symbols
- command output
- data types
- database elements
- defined (constant) values for an element or attribute
- enum names
- filenames and file paths
- folder and directory names
- HTTP status codes
- HTTP verbs
- IP addresses
- language keywords
- method and function names
- package names
- parameters
- port numbers
- URL strings or domain names
- text input or output
- Use ISO 8601 date formatting (YYYY-MM-DD).
External Dependencies
Do not add, under any circumstance, any new dependency to an SDK that does not already exist in the
gradle/libs.versions.toml, and even then, only do it if explicitly asked to do so. The Firebase
SDKs are designed to be lightweight, and adding new dependencies can increase the size of the final
artifacts.
Contributing
Contributions are welcome. Please read the contribution guidelines to get started.
Iteration Loop
After you make a change, here's the flow you should follow:
Format the code using
spotless. It can be run with:./gradlew :<firebase-project>:spotlessApplyRun unit tests:
./gradlew :<firebase-project>:check- If necessary, run integration tests based on the instructions above.
Updating this Guide
If new patterns or conventions are discovered, update this guide to ensure it remains a useful resource.
Trending
Quiet since August.about the whole repository
Who's talking about firebase/firebase-android-sdk
- Stack Overflow“API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with …”Stack Overflow · Mar 16, 2019 · 293 votes
- firebase/flutterfire“🐛 [firebase_core] java.lang.IllegalArgumentException: Service not registered: …”GitHub · Nov 11, 2020 · 49 reactions
- Stack Overflow“Android Error when communicating with the Firebase Installations server API”Stack Overflow · Apr 27, 2020 · 40 votes
- Stack Overflow“Android Error when communicating with the Firebase Installations server API”Stack Overflow · Apr 30, 2020 · 37 votes
- Stack Overflow“Play Store Warning : play-services-safetynet (com.google.android.gms:play-services-safetynet) has reported …”Stack Overflow · Jul 20, 2022 · 22 votes
The biggest 5 of 61 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 61
Talked about on Stack Overflow, GitHub and Hacker News (61 times).
On Stack Overflow · 30
- Mar 16, 2019API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()293 votes
- Apr 27, 2020Android Error when communicating with the Firebase Installations server API40 votes · 19 answers
- Apr 30, 2020Android Error when communicating with the Firebase Installations server API37 votes
- Jul 20, 2022Play Store Warning : play-services-safetynet (com.google.android.gms:play-services-safetynet) has reported critical issues with version 17.0.022 votes
- May 2, 2020Firebase cannot communicate with Firebase Server19 votes
25 more on Stack Overflow
- Aug 29, 2017How to send to "Miscellaneous" notification channel?16 votes
- Jan 28, 2021Why does I'm getting "Service not registered" exception, even though I not used any service in Android - Java/Kotlin?13 votes
- Jan 23, 2019API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()12 votes
- Jul 28, 2022Will preventing AD_ID permission to be merged affect Firebase functionality?11 votes
- Jan 23, 2019API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()9 votes
- Feb 18, 2020Specified path for unstripped native libs is not a directory - generateCrashlyticsSymbolFileRelease8 votes
- May 3, 2019Perform the Pending Writes When the App is Closed7 votes
- Sep 16, 2020FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host)6 votes · 2 answers
- Dec 6, 2018AGP 3.3 and Gradle 5.0 warning for variants that are obsolete and will be removed at the end of 20196 votes · 1 answer
- Jan 29, 2024FirebaseRemoteConfigClientException on production (Android)5 votes
- Dec 1, 2023Firebase Crashlytics - java.lang.IllegalStateException: The Crashlytics build ID is missing5 votes
- Dec 5, 2020auth().signInWithPhoneNumber() not working for react-native5 votes
- Aug 27, 2020java.io.IOException: AUTHENTICATION_FAILED in Android Firebase (and SERVICE_NOT_AVAILABLE)5 votes
- May 27, 2020Firebase Crashlytics - uploadCrashlyticsSymbolFile, OutOfMemoryError: Java heap space5 votes · 2 answers
- Apr 8, 2020How to check if Firebase Crashlytics is initialized?5 votes · 1 answer
- Jan 25, 2019API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()5 votes
- Oct 31, 2022Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules4 votes
- Apr 6, 2022FirebaseAuth - Requests from this Android client application <empty> are blocked4 votes
- Apr 4, 2022Android Firebase-Analytics : Not able to set null to userid and userproperty4 votes
- Mar 1, 2022How to display a message in the app when Firebase Analytics log event is successful?4 votes
- Nov 9, 2020Exception thrown while unbinding at com.google.android.gms.measurement.internal4 votes
- May 2, 2020FirebaseInstallationsException on latest version4 votes
- Apr 6, 2020Firebase Config: ClassNotFoundException4 votes
- Mar 6, 2020Firebase InApp messaging crash on Android 6 and 54 votes · 1 answer
- Jul 12, 2019Firebase Functions gives Timeout on Client side after 10s4 votes
On GitHub · 29
- Nov 11, 2020🐛 [firebase_core] java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.measurement.internal.zzji@dbed45a — firebase/flutterfire49 reactions · 38 comments
- Jul 19, 2023Fixing: `Type XYZ is defined multiple times` || `packages generated by more than one managed type` — dotnet/android-libraries20 reactions · 16 comments
- Jan 13, 2021🐛 [firebase_auth] App crashing when calling verifyPhoneNumber on android emulator after updating firebase_auth to 0.20.0 from 0.18.4 — firebase/flutterfire10 reactions · 40 comments
- Mar 30, 2026[cloud_firestore] Snapshot listeners stall on Android after upgrading to 6.1.3+ (Firestore native 26.0.2) — firebase/flutterfire9 reactions · 10 comments
- Mar 18, 2025[FR]: Make nowinandroid Gradle Isolated Projects compatible — android/nowinandroid8 reactions · 7 comments
24 more on GitHub
- Dec 6, 2022🐛 [firebase_dynamic_links] problem with targetSdkVersion 33 — firebase/flutterfire8 reactions · 23 comments
- Jun 22, 2020Quiet logging for emulators:exec — firebase/firebase-tools7 reactions · 3 comments
- Mar 6, 2026[cloud_firestore]: Upgrade to Android SDK 34.9 causes ANR on large/deeply nested documents — firebase/flutterfire6 reactions · 5 comments
- Aug 24, 2026fix(firebase_auth): compile Android Kotlin without checker-qual on inferred types — firebase/flutterfire4 reactions · 1 comment
- Jun 3, 2024앱 설정 Repository 구현 — MeetUpEat/Zipbab3 reactions
- Sep 14, 2025AGP 9 — android/nowinandroid2 reactions · 5 comments
- Aug 3, 2026deps: bump com.google.firebase:firebase-firestore from 26.0.1 to 26.5.0 — ZentithLLM/zentithllm1 reaction · 1 comment
- Jul 10, 2026deps: bump com.google.firebase:firebase-crashlytics from 20.0.2 to 20.1.0 — ZentithLLM/zentithllm1 reaction
- May 8, 2026deps: bump com.google.firebase:firebase-crashlytics from 20.0.2 to 20.0.6 — ZentithLLM/zentithllm1 reaction · 1 comment
- May 8, 2026deps: bump com.google.firebase:firebase-config from 23.0.1 to 23.1.0 — ZentithLLM/zentithllm1 reaction
- Apr 10, 2026deps: bump com.google.firebase:firebase-crashlytics from 20.0.2 to 20.0.5 — ZentithLLM/zentithllm1 reaction · 1 comment
- Apr 10, 2026deps: bump com.google.firebase:firebase-perf from 22.0.2 to 22.0.5 — ZentithLLM/zentithllm1 reaction · 1 comment
- Apr 10, 2026deps: bump com.google.firebase:firebase-firestore from 26.0.1 to 26.2.0 — ZentithLLM/zentithllm1 reaction · 1 comment
- Mar 13, 2026feat(firestore): Add support for pipeline subqueries — firebase/firebase-js-sdk1 reaction · 2 comments
- Feb 27, 2026deps: bump com.google.firebase:firebase-firestore from 26.0.1 to 26.1.1 — ZentithLLM/zentithllm1 reaction · 1 comment
- Jan 29, 2026build(deps): bump com.google.firebase:firebase-messaging from 24.1.0 to 25.0.1 — lusky3/underseerr1 reaction · 1 comment
- Jan 19, 2026deps: bump com.google.firebase:firebase-firestore from 26.0.1 to 26.1.0 — ZentithLLM/zentithllm1 reaction · 1 comment
- Jan 19, 2026deps: bump com.google.firebase:firebase-crashlytics from 20.0.2 to 20.0.4 — ZentithLLM/zentithllm1 reaction · 1 comment
- Jan 16, 2026deps: Bump com.google.firebase:firebase-firestore from 26.0.1 to 26.1.0 — ZentithLLM/zentithllm1 reaction
- Jan 16, 2026deps: Bump com.google.firebase:firebase-crashlytics from 20.0.2 to 20.0.4 — ZentithLLM/zentithllm1 reaction
- Nov 14, 2025deps: bump com.google.firebase:firebase-perf from 22.0.2 to 22.0.4 — ZentithLLM/zentithllm1 reaction · 1 comment
- Oct 19, 2024feat(messaging, android): add priority + originalPriority to RemoteMessage — invertase/react-native-firebase1 reaction · 1 comment
- Jun 24, 2021Re order plugins — firebase/quickstart-android1 reaction
- Jun 13, 2019fix build error with latest android studio — naman14/TimberX1 reaction
On Hacker News · 2
- Sep 6, 2018Google's Firebase Android SDKs are now open source5 points
- May 4, 2022Android Firebase Crashlytics Crashes on App Launch1 point
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- plugins/AGENTS.mdAGENTS.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

