Android API Diff
Use the android-api-diff CLI as the only tool interface. Keep its default JSON
output so results remain machine-readable.
Route the request
- Run
generatewhen the user wants Java hidden-API access code. It performs the version query internally, so never callqueryfirst. - Run
querywhen the user wants signatures, version ranges, availability, missing reasons, or source metadata. - Run
resolvewhen the user only needs the matchingframeworks/basefile and target kind. - Run
sourcewhen the user wants the complete content of a known source path at an exact Android release tag. If only an API name is known, runresolvefirst and use itssource.path. - Run
preloadonly when the user explicitly asks to preload several APIs.
Always quote API names because constructors and member references can contain shell-sensitive characters.
android-api-diff resolve "ContentObserver()"
android-api-diff source android-17.0.0_r1 core/java/android/accessibilityservice/AccessibilityButtonController.java
android-api-diff query "IActivityManager.getTasks" --min-sdk 28
android-api-diff generate "ActivityThread.currentApplication" --min-sdk 28
android-api-diff preload "ContentObserver()" "IActivityManager.getTasks" --min-sdk 28
Omit --min-sdk unless the user provides a minimum Android API level. The CLI
then uses its built-in default.
Interpret results
Treat exit code 0 together with top-level ok: true as success. Read the
operation result from the top-level result field.
For query, describe range endpoints as the first or last tag checked in the
current snapshot. A last-checked endpoint is not a promise that no later
revision exists.
For member queries, treat result.overloads as the source of truth. Each item
has a stable overloadId, its latest checked signature and member, and
independent ranges. A range with missingReason: "overload-not-found" means
the member name exists in that source revision but that specific parameter
signature does not. Use top-level result.ranges[].overloadIds only when
describing which overloads were available together.
On a nonzero exit code, read the structured JSON error from stderr and report its
error.code and error.message. Do not add an automatic retry: the CLI network
layer already retries transient fetches.
Handle a missing CLI
If android-api-diff is not installed, stop and tell the user to run:
npm install --global android-api-diff@latest
android-api-diff skill install
Run the Skill command from the root of the current Git or Gradle project so it remains project-scoped. Do not implement or simulate version checks. The package manager owns CLI update detection and upgrades.