Diagnose the Android toolchain
android_doctorDiagnose Android build and device failures by validating adb, SDK, JDK, and connected devices, then report exact issues and fixes.
Instructions
Check that the Android toolchain is usable and report exactly what is wrong when it is not.
Verifies adb, the SDK, the JDK, and connected devices; with a project path it also checks that project's Gradle wrapper against the JDK that would be used to build it — the mismatch that produces 'Unsupported class file major version'.
Run this first when a build or device command fails for a reason that is not obviously in the app's own code.
Args:
project_path (string, optional): Gradle root to include in the checks
module (string): module to inspect (default: 'app')
response_format ('markdown' | 'json')
Returns: { "healthy": boolean, "checks": [ { "name": string, "status": "ok"|"warn"|"fail", "detail": string, "fix": string } ], "toolchain": { "adb": string, "sdkRoot": string, "javaHome": string, "javaMajor": number } }
Examples:
Use when: a build fails and you do not yet know whether the cause is the project or the environment
Use when: adb commands fail and you want to know if the device is authorized
Use when: setting up on a new machine and want to confirm everything resolves
Error Handling:
Reports missing adb as a failed check with installation guidance, rather than throwing
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| module | No | Module to inspect. | app |
| project_path | No | Gradle root to include in the diagnosis. | |
| response_format | No | Output format: 'markdown' for human-readable, 'json' for machine-readable. | markdown |