Skip to main content
Glama

Build (and optionally install and launch) an Android app

android_build

Assemble an Android APK via Gradle and optionally install and launch it on a connected device, handling JDK compatibility and condensing build errors for quick iteration.

Instructions

Run a Gradle assemble for an Android project and, when asked, install the APK and start it on a device — the full edit-run loop in one call.

Handles the toolchain details that normally break automated builds:

  • picks a JDK Gradle can actually run on (Android Studio's bundled JBR when present), instead of trusting the ambient JAVA_HOME

  • refuses to start, with an explanation, when the JDK is newer than the Gradle wrapper supports

  • condenses a failed build's log down to the compiler errors instead of returning thousands of progress lines

The first build of a project downloads the Gradle distribution and dependencies and can take several minutes.

Args:

  • project_path (string): absolute path to the Gradle root (contains gradlew)

  • module (string): module producing the APK (default: 'app')

  • variant ('debug' | 'release'): build variant (default: 'debug')

  • clean (boolean): run the 'clean' task first (default: false)

  • install (boolean): install the APK after a successful build (default: false)

  • launch (boolean): start the app after installing; implies install (default: false)

  • serial (string, optional): target device when installing

  • timeout_ms (number): build timeout (default: 900000)

  • response_format ('markdown' | 'json')

Returns: { "success": boolean, "task": string, // e.g. "assembleDebug" "durationMs": number, "apkPath": string, // present on success "packageName": string, // resolved from applicationId / namespace / manifest "gradleVersion": string, "javaMajor": number, // JDK major version used "installed": boolean, "launched": boolean, "output": string, // build tail on success, error summary on failure "hint": string // present when the failure is recognised }

Examples:

  • Use when: "build and run this app on my phone" -> project_path=..., install=true, launch=true

  • Use when: verifying a code change compiles -> project_path=..., install=false

  • Don't use when: the APK is already built and you only want it installed (use android_install)

Error Handling:

  • "Unsupported class file major version" is caught before the build starts and reported as a JDK/Gradle mismatch with the fix

  • "SDK location not found" means local.properties or ANDROID_HOME is missing

  • Install failures report the adb failure code (e.g. INSTALL_FAILED_UPDATE_INCOMPATIBLE) with the usual remedy

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cleanNoRun the 'clean' task before assembling.
forceNoSkip the JDK/Gradle compatibility pre-check. Use only when the check is out of date and the combination is known to work.
launchNoStart the app after installing. Implies install.
moduleNoGradle module that produces the APK. Almost always 'app'.app
serialNoDevice serial from android_list_devices. Optional when exactly one device is connected; required when several are.
installNoInstall the APK after building.
variantNoBuild variant. 'release' requires signing config to be set up in the project.debug
timeout_msNoBuild timeout in milliseconds.
project_pathYesAbsolute path to the Gradle project root — the directory containing gradlew and settings.gradle.
response_formatNoOutput format: 'markdown' for human-readable, 'json' for machine-readable.markdown
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses important behaviors beyond annotations: JDK auto-selection, refusal when Gradle/JDK mismatch occurs, log condensing on failure, first-build download delays, and recognized error handling for SDK and install failures. No contradiction with annotations (readOnlyHint=false is expected for a build/install tool).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for purpose, details, args, returns, examples, and error handling. The Args section is redundant with the input schema and adds length without much value, but the rest is concise and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Even without an output schema, the description provides a full return object, concrete examples, error handling guidance, and toolchain context. It covers the tool's complexity comprehensively, including first-build delays and JDK mismatch behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description's Args section mostly repeats the schema verbatim and omits the 'force' parameter entirely, which is a notable gap. It adds little meaning beyond what the schema already provides (e.g., 'implies install' is also in the schema).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Run a Gradle assemble for an Android project and, when asked, install the APK and start it on a device.' It clearly distinguishes itself from siblings through the exclusions note ('Don't use when... use android_install') and the overall edit-run loop framing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit 'Use when' and 'Don't use when' guidance is provided, naming android_install as the alternative for already-built APKs. Also gives concrete scenarios: 'build and run this app on my phone' vs 'verifying a code change compiles.'

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jjs03111/android-build-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server