Guidance for AI coding agents working on this repository. For human contribution rules (CLA, PR process, AI-assisted contribution policy), see CONTRIBUTING.md.
The Maps SDK for Android Utility Library, split into focused submodules so
apps can depend only on what they need. maps-utils is the aggregator
artifact that pulls in all submodules; see MIGRATION.md for
the 4.x to modular layout mapping.
| Module | Purpose |
|---|---|
library |
Core utilities shared by the other modules |
clustering |
Marker clustering |
heatmaps |
Heatmap tile overlays |
data |
GeoJSON and KML parsing/rendering |
ui |
UI helpers (icon generators, bubbles) |
maps-utils |
Aggregator artifact, transitively includes the modules above |
lint-checks |
Custom Lint rules shipped with the library |
demo |
Demo app exercising the utilities |
visual-testing |
Screenshot/visual regression test harness |
Shared Gradle conventions are in build-logic/ (included build).
./gradlew assembleDebug # build everything
./gradlew :clustering:testDebugUnitTest # unit tests for one module
./gradlew test # all unit tests
./gradlew koverXmlReportDebug # all unit tests and coverage reports
./gradlew lint # Android Lint (includes lint-checks rules)Coverage is tracked over time. After every merge to main, the
Record coverage history workflow appends a row per module to
history.csv and regenerates COVERAGE.md, both of which live on the
coverage-history branch. They are generated by
.github/scripts/coverage_history.py. Never edit them by hand.
The data is kept off main deliberately. Branch protection on main uses
strict required status checks, so any commit pushed there marks every open
pull request out-of-date and forces contributors to update their branch and
re-run CI.
The history records unit test coverage. The CSV carries a suite column so
emulator coverage could be added later without changing the format.
The Demo smoke test workflow runs the demo app end to end on an emulator:
DemoSmokeTest opens every demo from the menu, waits for its map, zooms out
and back in, and navigates back. DemoCatalogTest fails if a demo activity is
declared in the manifest but missing from the menu, so add new demos to
demoGroups() in MainActivity.kt and they are covered automatically. To run
it locally with a device or emulator attached:
./gradlew :demo:connectedStandardDebugAndroidTest \
-Pandroid.testInstrumentationRunnerArguments.package=com.google.maps.android.utils.demo.smokeWithout a Maps API key in a valid format the demos close themselves and
DemoSmokeTest generates no cases. Add
-Pandroid.testInstrumentationRunnerArguments.requireMapLoaded=true to also
wait for map tiles to render, which needs a real key.
The library modules ship Baseline Profiles in
src/main/generated/baselineProfiles/baseline-prof.txt. They are generated by
the :baselineprofile module, which runs the demos on a device, and
BaselineProfileConventionPlugin in build-logic keeps only each module's own
classes. Regenerate them after changing a hot path (polyline utilities,
clustering, heatmaps, GeoJSON/KML layers, IconGenerator), with an emulator or
device attached and a real API key (the demos close themselves without one):
./gradlew :library:generateBaselineProfile :clustering:generateBaselineProfile \
:heatmaps:generateBaselineProfile :data:generateBaselineProfile \
:ui:generateBaselineProfileRunning the demo app requires a Maps API key in secrets.properties at the
repo root (see local.defaults.properties for the template). Never hardcode
or commit API keys.
This file is the shared instruction set for every coding agent. CLAUDE.md
and GEMINI.md only import it, and Codex and Copilot read it directly, so put
new guidance here rather than in a tool-specific file.
Skills live in .agents/skills/. .claude/skills and .gemini/skills are
symlinks to that folder, so edit the files under .agents/skills/ only.
.agents/skills/android-maps-utils/SKILL.md teaches agents how apps use this
library, and release-please bumps its version lines.
- Match the language and idiom of the file you are editing; new code is Kotlin unless it extends an existing Java API surface.
- Formatting follows
.editorconfig. - Do not use wildcard imports (
import foo.*); use explicit imports. - Avoid fully qualified class names in source code whenever possible; declare explicit imports at the file level instead (except to resolve naming collisions).
- Build with the Java 17 toolchain (
jvmToolchain(17)), but publish the library modules with JVM 11 bytecode (jvmTarget11 and JavasourceCompatibility/targetCompatibility11). Consumers that target JVM 11 cannot inline Kotlininlinefunctions compiled for a higher target, and android-maps-compose and other dependent libraries inherit that requirement (see discussion #1849). Do not raise the published bytecode target without a discussion first. Thedemoandbaselineprofileapps are not published and stay on 17. - Keep Android Lint in sync with AGP (
Lint = AGP + 23): Never bumplint(com.android.tools.lint:*,com.android.tools:testutils) independently ofgradle(AGP) ingradle/libs.versions.toml.:lint-checkscompiles againstcompileOnlyLint APIs while AGP supplies the runtime engine, so rootbuild.gradle.ktsenforceslint == AGP + 23. - KDoc/Javadoc on all public classes and methods; this is a widely consumed library and its docs are published.
- Public API changes must be additive and backward compatible; deprecate before removing. Breaking changes only in a major release with a MIGRATION.md entry.
- Put a change in the most specific submodule, not
library, unless it is genuinely shared.
-
Use Conventional Commit messages (
feat:,fix:,docs:,chore:,build(deps):,test:,refactor:,perf:). release-please parses them to generate versions and CHANGELOG.md; a wrong prefix causes a wrong release bump. -
PR Title Validation: Ensure PR titles strictly conform to Conventional Commits (e.g.,
fix: stale QuadItem removalinstead ofFix stale QuadItem removal). When PRs are squash-merged intomain, GitHub uses the PR title as the default commit header; a non-conforming title prevents release-please from accurately categorizing changes in CHANGELOG.md or calculating semantic version increments. -
Never edit CHANGELOG.md or
.release-please-manifest.jsonby hand. -
Several changes in one PR: a squash merge keeps only the PR title, so release-please would list one entry. When a PR contains several changes that belong in the changelog separately (for example several bug fixes), add a commit override block at the end of the PR description, one Conventional Commit per line. release-please uses these lines instead of the PR title:
BEGIN_COMMIT_OVERRIDE fix(data): apply styles referenced through a KML StyleMap fix(data): do not crash on a KML Style or StyleMap without an id END_COMMIT_OVERRIDEThe PR title still has to be a valid Conventional Commit. Each line counts for the version bump, so a
feat:or!line bumps accordingly. -
Keep a pull request to what its title says. Once review has started, put new features or unrelated fixes in a separate pull request. If the scope does change, update the type in the title (a
refactor:that now adds behavior is afeat:), since release-please reads it. -
Answer every review thread before asking for another review: push the change, or reply in the thread with why not. A new commit alone does not tell the reviewer which comments it addresses.
-
Never commit anything that only makes sense on your machine or inside Google: local paths (
file:///,/Users/..., workstation home directories),go/links,b/bug IDs or API keys. TheAgent leftoverscheck fails the pull request on these, and on AI co-author trailers and links to agent chat sessions. -
Every behavior change needs a unit test in the affected module.
-
All pull requests are to be created as drafts (
gh pr create --draft) until authorization is explicitly given to mark them ready for review. Always inform the user that the PR was created as a draft. -
Run the module's tests and
lintbefore declaring work done, and report actual results. -
Do not add dependencies to library modules without discussion in an issue first.
-
AI tools must not be listed as authors or co-authors on commits or PRs, and unsolicited bot-generated PRs are prohibited (see CONTRIBUTING.md).