Android CLI Command Reference
The Android CLI is a unified developer interface architected to standardize environment control, workspace orchestration, and execution capabilities for standalone developer loops and automated AI agents. It serves as an optimized runtime engine connecting local projects directly to official tools, execution layers, and the centralized Android Knowledge Base.
Installation & Global Setup
Follow these structural phases to establish the system binary paths and expose core system hooks to target development execution layers.
Binary Deployment
Download the latest platform release build from the official Android Tools Repository.
Agent Provisioning
Instantiate global environmental capabilities and deploy core workflow parameters using the initialization loop:
android init
Path Verification
Validate proper binary mapping within your active shell configuration paths by requesting path routes:
command -v android
# Synchronize system toolchain binaries to latest stable baseline
android update
# Confirm active runtime architecture version parameters
android -V
Runtime Environment Configurations (.androidrc)
Automate default flag overrides by populating a localized runtime configuration schema. Preserve this configuration map at the following system roots based on target platform architecture:
~/.androidrc%USERPROFILE%\.androidrc# Force consistent baseline Android SDK paths across execution sessions
--sdk=/path/to/your/compiled/android-sdk
# Set default agent pipeline delivery targeting formats
--format=json
Telemetry & Collection Transparency
The system records specific operational metrics to track framework execution health. Review our absolute structural definitions below regarding metadata capture scopes:
🟢 Process Data Collected
- Explicit execution logs of
androidsub-commands (e.g.,run,create). - Structural definitions of passed global or local arguments (e.g.,
--sdk,--version). - Predefined platform target arguments, layout shapes, and connected agent profiles (e.g.,
medium_phone,large_desktop,GEMINI,CLAUDE). - Anonymized application trace arrays, internal exit codes, and sanitized stack traces.
🔴 Context Omitted (Never Collected)
- Raw stdout/stderr payload streams or object payload configurations returned by target commands.
- User-defined arguments containing proprietary logic, names, localized project directory routing strings, or unique Maven addresses.
- Example:
--name=com.company.internal.apprecords only the usage of the--namekey, safely throwing away the value string.
Global Option Flags
These arguments modify base behaviors and can be interspersed into any standard operational pipeline loop configuration.
| Flag Parameter | Syntax Format | Functional Behavior |
|---|---|---|
-h, --help |
android [command] -h |
Interrogates structural target systems to return localized manual routing layouts and command requirements. |
--sdk |
android --sdk=<path> [command] |
Injects a temporary, context-isolated path mapping to a target Android SDK, bypassing global system environmental mappings for the duration of the current loop execution. |
-V, --version |
android -V |
Displays active system runtime and binary compilation version indexes. |
Core Command Reference Matrix
Every structural call must be explicitly structured as a child routing under the base system binary entry point: android <command>.
🏗️ Workspace & Architectural Scaffolding
createandroid create [-o|--output=<path>] [--name=<app-name>] [--dry-run] [--verbose] [<template>]Deploys localized project workspaces derived from verified architectural boilerplates. If the template parameter is dropped, the system safely falls back onto the modern empty-activity-agp-9 platform baseline layout.
-o, --outputRequired Target path configuration directory for template output extraction.--dry-runSimulates file construction trees and execution scopes safely without logging permanent adjustments to the underlying disk layout.--verboseElevates logging structures to expose every discrete path creation event and copy process.
android create --dry-run --verbose -o="./workspaces/demo" empty-activity-agp-9
create listandroid create listQueries remote build distributions to return an active layout list of available workspace archetypes available for generation loops.
describeandroid describe [--project_dir=<path>]Scans systemic file layout architectures to generate detailed structural JSON schemas mapping project configuration trees, active compilation boundaries, and downstream output file destinations (e.g., APK locations) for ingestion by automation tools.
infoandroid infoExposes active resolution paths mapping to the target operational Android SDK instance currently bound to the environment scope.
🧠 Agent Orchestration & Knowledge Base
initandroid initBootstraps local shell layouts and automated scripting engines by deploying the underlying android-cli instructions directly to global execution layers.
docs search | fetchandroid docs search '<query>' | android docs fetch kb://<target-url>Executes semantic lookups across the official Android Knowledge Base directory. Query runs return highly specialized reference URLs prefixed with kb:// protocols, which can be sequentially consumed via the fetch instruction to unpack technical reference data straight to system output streams.
android docs search 'How do I improve my app performance?'
android docs fetch kb://android/topic/performance/overview
skills add | find | list | removeandroid skills add [--all] [--agent=<target>] [--skill=<name>]Maintains high-context developer behavior profiles configured for external AI engines. If specific agent targets are dropped during invocation, profiles fallback to map settings directly across detected local directories (defaulting paths inside ~/.gemini/antigravity/skills).
--allProvisions or streams structural version changes down across every supported skill simultaneously.--longInstructsskills listpipelines to expand functional parameters, capability lists, and active agent mappings.
android skills add --agent='gemini' edge-to-edge
android skills find 'performance'
🖥️ Virtualization, Runtime Inspection & Vision
emulator create | list | start | stopandroid emulator start <device-name> | android emulator stop <serial>Manages software virtualization layer Lifecycles directly through your terminal workspace. Invocations of emulator create safely fallback to instantiate a baseline medium_phone image blueprint if explicit profiles are omitted.
android emulator start medium_phone
android emulator stop emulator-5554
layoutandroid layout [-p|--pretty] [-o|--output=<file>] [-d|--diff]Interrogates the active foreground screen layout of a targeted execution hardware node, capturing structural layout trees in validated JSON formatting arrays.
-p, --prettyInjects standard indentation spacing into generated JSON arrays to streamline human parsing.-d, --diffLimits extraction loops to return exclusively the individual UI components that mutated relative to the preceding systemic screen capture layout step.
runandroid run --apks=<paths> [--activity=<name>] [--device=<serial>] [--type=<param>]Deploys pre-compiled binaries directly to active destination endpoints. This utility handles no build orchestration tasks; valid execution dependencies require passing raw target artifact addresses directly.
--apksRequired Multi-target values accepted via comma-separated address lists (e.g.,base.apk,split_hdpi.apk).--typeRoutes explicit orchestration entry-points for non-standard app architectures. Valid ecosystem configurations accept:ACTIVITY,WATCH_FACE,TILE,COMPLICATION,DECLARATIVE_WATCH_FACE.
android run --apks=app-debug.apk --type=SERVICE --activity=.sync.DataSyncService
screen captureandroid screen capture [-o|--output=<path>] [-a|--annotate]Captures structural window visual maps from active runtimes. Appending --annotate triggers geometric inspection layers that isolate design parameters, drawing distinct object bounding vectors mapped directly around captured components.
screen resolveandroid screen resolve --screenshot=<path> --string="<command-template>"Translates indexed layout labels identified during annotated screen capture passes into absolute programmatic layout coordinates (x, y). This eliminates manual calculation steps from interaction scripts.
# Processing input string parameter keys mapped to index identifier components
android screen resolve --screenshot=ui.png --string="input tap #5"
# Returns calculated system input boundaries: "input tap 500 1000"
📦 Toolchain & SDK Lifecycle Management
sdk install | list | remove | updateandroid sdk install <package@version> [--beta] [--canary] [--force]Controls target operational system platform tooling, images, and compilation dependencies across isolated software release loops.
package@versionDefines explicit targeted components. Omit version parameters to target the newest available release.--canaryModifies target validation systems to expose experimental package distribution indices.--forceRelaxes system version warnings to permit targeted engine downgrades across packages.
android sdk install platforms/android-34 build-tools/34.0.0
android sdk install --canary system-images/android-35/google_apis/x86_64
android sdk update
🔌 Android Studio Deep Integration Links
The studio instruction group facilitates two-way communication loops with running IDE instances via process boundary bridges—granting automated scripts programmatic access to compiler insights, semantic indexes, and visual previews.
studio checkandroid studio checkInterrogates system processes to verify active connections with background IDE frames, logging details regarding process identifiers (PIDs) and project operational health maps.
pid: 32942 | version: Android Studio Quail | Status: READY (MyApplication)
studio analyze-fileandroid studio analyze-file [--pid=<id>] [--project=<name>] <file-path>Passes target code addresses (Kotlin/Java) straight to the active IDE linting environment, capturing compile-time error parameters, logical inspection alerts, and semantic warnings.
studio find-declaration | find-usagesandroid studio find-usages [--short] <symbol-identifier>Queries deep code graphs to trace structural definitions or find references across the current workspace layout via semantic analysis engines.
--context-filePasses localized reference maps to accelerate resolution speeds across matching overloaded symbols.--shortTruncates detailed diagnostic layout responses to pass exclusively clean file-path strings and matched lines.
android studio find-declaration --short HotelDetailScreen
studio open-fileandroid studio open-file <target-file-path>Brings a file to the active foreground editor tab within your running Android Studio workspace layout.
studio render-compose-previewandroid studio render-compose-preview [--print-semantics] [--output-image-file=<name>] <path> <composable-name>Instructs the background IDE compiler to execute design layout renders of isolated Jetpack Compose components flagged with @Preview decorations, capturing output frames as structured image payloads.
--print-semanticsEvaluates component configuration trees to output an interactive layout accessibility schema in structural JSON arrays, enabling tools to programmatically click or navigate structural layout maps.
studio version-lookupandroid studio version-lookup <artifacts...>Queries Google Maven repositories and platform release manifests programmatically to determine the newest available package targets, tracking elements including agp, kotlin, ndk, and custom core libraries.
android studio version-lookup androidx.compose.ui:ui agp kotlin

Comments
Post a Comment