android_build
Run Gradle builds safely alongside Android Studio, avoiding file lock conflicts, and get a detailed failure report with errors, context, and a markdown brief for quick fixes.
Instructions
Build the project with Gradle, safely alongside Android Studio, and explain any failure.
ALWAYS use this instead of running gradlew in a terminal: an agent terminal runs Gradle in a sandboxed daemon that keeps R.jar locked against Android Studio. This tool runs the build in Android Studio's own daemon pool, waits if Studio is building, and names any process holding a locked file.
On failure the result is a complete report: category, every compiler/resource error with its file, line and surrounding source, Gradle's explanation, recently changed files, and the path of a self-contained markdown brief you can hand to a fixer subagent.
Args: project_dir: Gradle root (the folder containing settings.gradle[.kts] and gradlew). module: App module, used to derive the default task and find the APK. variant: Build variant, e.g. debug or freeDebug. tasks: Explicit Gradle tasks. Default "::assemble". For a fast compile-only check use [":app:compileDebugKotlin"]. install: Install the built APK on the device afterwards. device: Device serial for install; defaults to the first physical device. release_locks: Stop IDLE Gradle/Kotlin daemons that hold this project's build outputs (e.g. one left behind by an agent terminal). Never touches busy builds. allow_uninstall: If install hits a signature/version conflict, uninstall first (wipes data). wait_if_busy_s: How long to wait for a busy Android Studio daemon before giving up. timeout_s: Build time limit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tasks | No | ||
| device | No | ||
| module | No | app | |
| install | No | ||
| variant | No | debug | |
| timeout_s | No | ||
| project_dir | Yes | ||
| release_locks | No | ||
| wait_if_busy_s | No | ||
| allow_uninstall | No |