How to Use Lightbuild for Agent-Friendly Android Builds
Set up Lightbuild in Android Studio Canary, create YAML projects, and run builds with the Lightbuild CLI for AI agents.
Android builds traditionally rely on Kotlin DSL files that agents struggle to parse and edit safely. Lightbuild changes that with a declarative YAML approach designed for both humans and AI coding agents.
This experimental system ships in Android Studio Canary and pairs with the Lightbuild CLI. It keeps project opens fast, eliminates manual syncs after config changes, and includes an AGENTS.md file that guides agents on structure and commands.
Use it for new projects, prototypes, and demos. Stable Android Studio does not support Lightbuild projects. Keep production work on Kotlin DSL until Lightbuild reaches general availability.
What you need
- Latest Android Studio Canary. Install it beside your stable copy from the preview page.
- Android CLI installed and updated. Run
android updateif you already have it. - Lightbuild CLI package installed via Android CLI (version 0.0.30 at the time of writing).
- A clean machine or separate directory for testing. Agents can edit many files.
Lightbuild works with Android CLI for device control and Android Studio Canary for visual editing, debugging, and Compose previews.
Install the Lightbuild CLI
The Lightbuild CLI is an Android SDK package. Install it after Android CLI is ready.
On macOS or Linux:
android sdk install build/lightbuild/0.0.30 && bash "$(android info sdk)/build/lightbuild/0.0.30/cli/install.sh"
On Windows PowerShell the equivalent chains the SDK install with the package setup script. After installation, open a new terminal and confirm with:
lightbuild --version
If the command is missing, check that ~/.local/bin (or the Windows equivalent) is on your PATH.
Create a Lightbuild project
In Android Studio Canary
- Open the Canary install and choose New Project.
- Select a compatible template such as Empty Activity or Navigation UI Activity.
- On the configuration screen, set Build configuration language to Lightbuild.
- Finish the wizard. Studio creates
project.lightbuild.yamlat the root, alightbuild.yamlin each module, aresolved.depsfile, and anAGENTS.mdfile.
You can also ask the AI project assistant to generate the project and select Lightbuild on the final screen.
From the command line
android create empty-activity-lightbuild --name="Lightbuild Demo" --output=lightbuild-demo
Open the resulting folder in Android Studio Canary. The declarative files are already in place.
Understand the file layout
project.lightbuild.yamlholds project-wide settings: name, modules, repositories, Java/Kotlin versions, and the Lightbuild version.- Each module has its own
lightbuild.yamldeclaring platform, type (application or library), Android SDK levels, dependencies, and namespace. resolved.depsrecords resolved dependencies so opens and builds skip dynamic resolution. Check it into version control. Do not edit it by hand.AGENTS.mdtells agents the preferred commands (lightbuild build,lightbuild test,android run) and project conventions.
Because the files are pure YAML, an agent can update a dependency version or add a module without risking executable Groovy or Kotlin logic.
Build, test, and run
From the project root:
lightbuild build app
List targets with lightbuild query .... Inspect output files with lightbuild query app --output=files.
Run tests:
lightbuild test
Or target a specific module and test type (:hostTest or :deviceTest).
The Lightbuild CLI builds the APK or AAB but does not install it. Use Android CLI for that step:
lightbuild build app
android run --apks=app/build/app-debug.apk
Resolve dependencies after changes:
lightbuild resolve
Clean with lightbuild clean.
If you already use Android CLI skills and agent plugins, the same workflow applies. See our guide on Android CLI agent skills for setting up Claude, Codex, or Antigravity with official Android knowledge.
Tips for agent workflows
- Keep the first agent task narrow: “Add a dependency on androidx.lifecycle:lifecycle-viewmodel-compose and resolve it.”
- Let the agent edit the YAML, then run
lightbuild resolveandlightbuild buildyourself before accepting the diff. - Prefer
AGENTS.mdinstructions that name exact commands rather than vague goals. - Stay on Canary only for Lightbuild experiments. Stable Rabbit 2 supports Bring Your Own Agent but not Lightbuild projects.
- File issues at the Lightbuild feedback tracker if a command fails.
Limitations to know
Lightbuild 0.0.30 is an early preview. It does not yet support version catalogs, product flavors, Kotlin Multiplatform modules, or custom plugins. Google documents it for new projects and prototypes, not production apps you ship today.
Project opens are faster because dependencies are pre-resolved, but you still need the Canary IDE for full debugging and layout inspection.
Conclusion
Lightbuild gives agents a predictable YAML surface for Android build configuration while you keep control in Android Studio Canary or the terminal. Install the CLI, create a project with the Lightbuild template, and give an agent one small edit task. Pair it with Android CLI for device and knowledge-base access.
When the feature leaves preview, the same files and commands will move into daily use. Until then, treat it as a lab tool that makes agent-assisted prototyping less error-prone than editing Gradle scripts by hand.
Sources
- Overview of Lightbuild — Android Developers
- Get started with Lightbuild — Android Developers
- Build Lightbuild projects from the command line — Android Developers
- Lightbuild configuration reference — Android Developers
- Build Android apps using any AI agent with Android CLI and skills — Android Developers
Share this story