[ Web Proxy ]
URL:
Viewing: https://developer.android.com/tools/agents/android-cli [Back]  [Original]

Overview of Android CLI  |  Android Studio  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]

Overview of Android CLI Stay organized with collections Save and categorize content based on your preferences.

Android CLI is a command-line interface that enables you to more easily and efficiently build for Android using any tool of your choice. It standardizes core development competencies for agent-first workflows, providing an entry point to the official tools, skills, and knowledge you need to develop more effectively. It can also streamline CI, maintenance, and any other scripted automation for the increasingly distributed nature of Android development.

For example, an agent or script can use the CLI to do tasks such as the following:

Android CLI also gives your agents access to Android skills and the specialized Android Knowledge Base to help ensure that your projects apply Android-recommended patterns and best practices.

Install Android CLI

To install Android CLI, follow these steps:

  1. Download Android CLI.

  2. To make sure you're using the latest version, update Android CLI:

    android update
    
    Tip: Run android update regularly to keep up with the latest features.

To check if Android CLI is already installed on your machine, run which android or command -v android: if it returns a path, then it's installed.

Set up for agents

To help agents understand and use Android CLI, run init to install the android-cli skill:

android init

Data collected

Android CLI collects data on basic usage of the tool. Here's the data that we collect:

Here are some examples of data that we don't collect:

Feedback and issues

If you encounter any issues or want to provide feedback, report a bug.

Known issues

Configure Android CLI

Create a .androidrc file to automatically apply flags and options every time you invoke Android CLI. Save the file in the following location, depending on your operating system:

Add the flags you want to apply automatically to the file, one per line.

For example, to make Android CLI use a specific Android SDK by default every time, add the --sdk flag to your file:

--sdk=<path-to-sdk>

Global options

These are optional flags that you can use with other Android CLI commands.

-h, --help

Usage: android <command> -h

Description: Display the help manual for the tool or specific command in question.

Examples:

--sdk

Usage: android --sdk=<path-to-sdk> <command>

Description: The path to the Android SDK that you want to use for the command that follows. You can use the --sdk setting to temporarily override the default Android SDK instead of changing your global environment variables every time you want to switch. To check which Android SDK you're using by default, run android info.

Example: android --sdk=<path/to/sdk> sdk list

Commands

This section lists all the Android CLI commands and describes what they do. All of these commands should be preceded by android, for example android create, android run, and so on. Optional modifiers are enclosed in brackets [] and mandatory arguments are not.

create

Usage: android create [--dry-run] [--verbose] [--name=<application-name>] [--output=<dest-path>] [<template-name>]

Description: Initialize a new project from a template. To see the template options, run android create -h.

Arguments (mandatory):

Options:

Example: android create --dry-run --verbose empty-activity-agp-9

create list

Usage: android create list

Description: List all the available templates to create a new project from.

describe

Usage: android describe [--project_dir=<project-directory>]

Description: Analyzes an Android project to generate descriptive metadata. This command identifies and outputs the paths to JSON files that detail the project's structure, including build targets and their corresponding output artifact locations (for example, APK files). This information enables other tools and commands to locate build artifacts efficiently.

Options:

Example: android describe --project_dir=/path/to/your/project

docs

Usage:

Description: The android docs command is a two-step process for accessing the Android Knowledge Base directly from the CLI. First, search for documentation related to your query using the search command. The search results will include special URLs starting with kb://, which you can then use with the fetch command to output the documentation commands to the terminal.

Examples:

emulator create

Usage: android emulator create [--list-profiles] [--profile=<profile-name>]

Description: Create a virtual device.

Options:

emulator list

Usage: android emulator list

Description: List the available virtual devices.

emulator start

Usage: android emulator start <device-name>

Description: Launch the specified virtual device.

Arguments (mandatory):

Example: android emulator start medium_phone

emulator stop

Usage: android emulator stop <device-serial-number>

Description: Stop the specified virtual device.

Arguments (mandatory):

Example: android emulator stop emulator-5554

info

Usage: android info

Description: Display the path to the default Android SDK used. To change the Android SDK used, use --sdk.

init

Usage: android init

Description: Set up your environment for agents by installing the android-cli skill.

layout

Usage: android layout [--pretty] [--output] [--diff]

Description: Returns the UI layout of the active Android app (connected through a physical device or emulator) in JSON format.

Options:

Example:: android layout --output=./hierarchy.json

run

Usage: android run [--debug] [--activity=<activity-name>] [--device=<serial-number>] [--type=<param>] --apks=<apk-paths>

Description: Deploy an Android app to a connected device or emulator. It doesn't perform any build steps; you must provide the path(s) to the APK files that you want to install.

Arguments (mandatory):

Options:

Examples:

screen capture

Usage: android screen capture [--output] [--annotate]

Description: Captures a screenshot of the connected device.

Options:

Example: android screen capture --output=ui.png

screen resolve

Usage: android screen resolve --screenshot=<path> --string=<string>

Description: Translates the visual labels from an annotated screenshot, captured using screen capture, into actual screen coordinates (x, y). Useful for scripting clicks on elements without having to manually calculate their positions.

Flags:

Example:

If the label 5 is at coordinates (500, 1000), then the command

android screen resolve --screenshot=ui.png --string="input tap #5"

returns the output

input tap 500 1000

sdk install

Usage: android sdk install <package[@version]> [--beta] [--canary] [--force]

Description: Install the specified SDK package(s).

Arguments (mandatory):

Options:

Examples:

sdk list

Usage: android sdk list <package-pattern>

Description: List the installed and available SDK packages.

Arguments (mandatory):

Options:

sdk remove

Usage: android sdk remove <package-name>

Description: Remove a package from the SDK.

Arguments (mandatory):

Example: android sdk remove build-tools/36.1.0

sdk update

Usage: android sdk update [--beta] [--canary] [<package-name>]

Description: Update one or all packages to the latest version in the channel (by default the stable channel). If you don't specify a package, all packages will be updated.

Options:

Examples:

skills add

Android skills are special instructions designed to help agents better understand and execute specific patterns that follow best practices and guidance on Android development. To learn more, see Intro to Android skills.

Usage: android skills add [--all] [--agent=<agent-name>] [--skill=<skill-name>]

Description: Install Android skills to the skills directories for all detected agents. If you don't have any existing agent directories and don't specify particular agents, the skills will be installed for Gemini and Antigravity at ~/.gemini/antigravity/skills. If you already have Android skills installed, skills add updates the skills to the latest version.

Note: If you customize a skill, you should rename it, or it will get overwritten when you update it using skills add.

Options:

Example: android skills add --agent='gemini' edge-to-edge

skills find

Usage: android skills find <string>

Description: Find skills that match a given string.

Arguments (mandatory):

Example: android skills find 'performance'

skills list

Usage: android skills list [--long]

Description: List the available skills.

Options:

skills remove

Usage: android skills remove [--agent] --skill=<skill-name>

Description: Remove a skill. If you don't specify particular agents, the skill will be removed for all agents.

Arguments (mandatory):

Options:

Example: android skills remove --agent='gemini' --skill=edge-to-edge

studio check

Preview: To use the studio commands, you must have your project open in Android Studio Quail 2 Canary 1 or higher, and have Gemini in Android Studio enabled and signed in.

The studio commands enable you or your AI agent to interact with active instances of Android Studio. By connecting to a running instance, you can use the IDE's capabilities to analyze files, find symbol declarations and usages, render Compose previews, and look up dependency versions.

Usage: android studio check

Description: Checks the status of running Android Studio instances and lists open projects. Run this command first to verify the connection between the CLI and the IDE, and to select the PID and project you want to connect to, if there are multiple.

Output example:

If connected, the output lists the PID of the running Android Studio instance, the version, and the status of open projects:

pid: 32942
version: Android Studio Quail
Projects:
    READY     MyApplication /Users/username/AndroidStudioProjects/MyApplication

studio analyze-file

Usage: android studio analyze-file [--pid=<pid>] [--project=<project>] <path>

Description: Analyzes a file in Android Studio for errors, warnings, and lints using the IDE's built-in inspection engine.

Arguments (mandatory):

Options:

Example:

android studio analyze-file \
  --project=MyApplication \
  /Users/username/AndroidStudioProjects/MyApplication/app/src/main/java/com/example/myapp/MainActivity.kt

studio find-declaration

Usage: android studio find-declaration [--short] [--context-file=<path>] [--pid=<pid>] [--project=<project>] <symbol>

Description: Finds the exact declaration site of a symbol (class, method, variable, field, constant, or Android resource) across the project using semantic resolution.

Arguments (mandatory):

Options:

Example:

android studio find-declaration --short HotelDetailScreen

studio find-usages

Usage: android studio find-usages [--short] [--pid=<pid>] [--project=<project>] <symbol>

Description: Finds all references and usages of a symbol across the entire project using semantic analysis.

Arguments (mandatory):

Options:

Example:

android studio find-usages --short HotelDetailScreen

studio open-file

Usage: android studio open-file [--pid=<pid>] [--project=<project>] <path>

Description: Opens a file directly in the active editor window of Android Studio.

Arguments (mandatory):

Options:

Example:

android studio open-file app/src/main/java/com/example/myapp/ui/DetailScreen.kt

studio render-compose-preview

Usage: android studio render-compose-preview [--print-semantics] [--output-image-file=<filename>] [--pid=<pid>] [--project=<project>] <path> <composable>

Description: Renders a Jetpack Compose UI Preview and optionally returns its layout semantics tree. This is useful for visual testing or for enabling AI agents to work with the UI layout.

Arguments (mandatory):

Options:

Example:

android studio render-compose-preview \
  --output-image-file=preview_hotel.png \
  --print-semantics \
  app/src/main/java/com/example/myapp/ui/DetailScreen.kt \
  HotelDetailScreenPreview

studio version-lookup

Usage: android studio version-lookup [--pid=<pid>] [--project=<project>] <artifacts...>

Description: Looks up the latest available versions of common dependencies, Android platforms, and SDK tools in repositories such as Google Maven. This provides a programmatic alternative to manual dependency version checking.

Arguments (mandatory):

Options:

Example:

android studio version-lookup \
  androidx.compose.ui:ui \
  com.android.application \
  agp \
  kotlin

update

Usage: android update

Description: Update the Android CLI.

-V, --version

Description: Show the current version of the Android CLI.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-06-16 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-16 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page