Skip to main content

Android CLI: Beyond the IDE

Agent-First Workflows

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.

Phase 1

Binary Deployment

Download the latest platform release build from the official Android Tools Repository.

Phase 2

Agent Provisioning

Instantiate global environmental capabilities and deploy core workflow parameters using the initialization loop:

android init
Phase 3

Path Verification

Validate proper binary mapping within your active shell configuration paths by requesting path routes:

command -v android
Terminal Session
# 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:

POSIX (macOS & Linux): ~/.androidrc
Windows NT Systems: %USERPROFILE%\.androidrc
.androidrc Template
# 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 android sub-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.app records only the usage of the --name key, 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

create
Usage: android 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, --output Required Target path configuration directory for template output extraction.
  • --dry-run Simulates file construction trees and execution scopes safely without logging permanent adjustments to the underlying disk layout.
  • --verbose Elevates 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 list
Usage: android create list

Queries remote build distributions to return an active layout list of available workspace archetypes available for generation loops.

describe
Usage: android 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.

info
Usage: android info

Exposes active resolution paths mapping to the target operational Android SDK instance currently bound to the environment scope.

🧠 Agent Orchestration & Knowledge Base

init
Usage: android init

Bootstraps local shell layouts and automated scripting engines by deploying the underlying android-cli instructions directly to global execution layers.

docs search | fetch
Usage: android 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 | remove
Usage: android 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).

  • --all Provisions or streams structural version changes down across every supported skill simultaneously.
  • --long Instructs skills list pipelines 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 | stop
Usage: android 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.

⚠️ Platform Constraint: Emulator daemon commands are currently unavailable on Windows host architectures.
android emulator start medium_phone
android emulator stop emulator-5554
layout
Usage: android 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, --pretty Injects standard indentation spacing into generated JSON arrays to streamline human parsing.
  • -d, --diff Limits extraction loops to return exclusively the individual UI components that mutated relative to the preceding systemic screen capture layout step.
run
Usage: android 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.

  • --apks Required Multi-target values accepted via comma-separated address lists (e.g., base.apk,split_hdpi.apk).
  • --type Routes 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 capture
Usage: android 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 resolve
Usage: android 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 | update
Usage: android sdk install <package@version> [--beta] [--canary] [--force]

Controls target operational system platform tooling, images, and compilation dependencies across isolated software release loops.

  • package@version Defines explicit targeted components. Omit version parameters to target the newest available release.
  • --canary Modifies target validation systems to expose experimental package distribution indices.
  • --force Relaxes 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

🔧 System Requirements: Requires active project sessions running on Android Studio Quail (2026.1.1) Canary 1 or higher with structural Gemini sign-in configurations active.

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 check
Usage: android studio check

Interrogates 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-file
Usage: android 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-usages
Usage: android 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-file Passes localized reference maps to accelerate resolution speeds across matching overloaded symbols.
  • --short Truncates detailed diagnostic layout responses to pass exclusively clean file-path strings and matched lines.
android studio find-declaration --short HotelDetailScreen
studio open-file
Usage: android 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-preview
Usage: android 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-semantics Evaluates 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-lookup
Usage: android 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
Ecosystem Discrepancy Alert: Microsoft Windows Shell subsystems running native PowerShell wrappers require elevated administrative verification levels to securely bind target virtualization layers. For detailed platform integration updates or to file functional pipeline anomalies, access the official tracking node via the Google Issue Tracker.

Comments

Popular posts from this blog

Flutter™ Installation Without Android Studio™

When developing with Flutter™, you typically install Android Studio™ as part of the setup process. However, if you want a lightweight alternative, you can install Flutter™ with only the Android command-line tools. This guide walks you through the steps to set up Flutter™ on Windows without Android Studio™. Step 1: Install Android Command-Line Tools Download Command-Line Tools: Download the Android SDK Command-Line Tools from the Android Developer website . Extract the downloaded zip file: Extract it to a directory, e.g., C:\Users\<User Name>\AppData\Local\Android\Sdk\cmdline-tools . Set up SDK directories: Inside the cmdline-tools folder, create a subfolder named latest . Move the extracted files and folders into this latest folder. The structure should look like: ...

Building a Modular Project with a Monorepo Using Pub Workspaces Feature

Flutter™  projects often start small, but as they scale, managing multiple packages becomes challenging. If you find yourself working with several modules or features in one project, organizing them efficiently is crucial. Enter Monorepos with Pub Workspaces – an excellent solution for managing a Flutter project with multiple packages in a modular way. In this post, we’ll explore how to structure a Flutter project in a modular way using a monorepo , and how to manage dependencies across various sub-projects without worrying about version conflicts. We’ll also look at how to configure Pub Workspaces to simplify dependency resolution and management. When working with Flutter™ and Dart™ , structuring a project in a modular way can improve scalability and maintainability. This is especially important when managing multiple packages in a single repository, also known as a monorepo . Pub Workspaces , introduced to simplify dependency management, provide a robust solution...

Stop Guessing: A Scalable Strategy for Flutter Environment Management

When building production-grade applications, hardcoding API endpoints, feature flags, or tracking keys directly into your source code is an architectural anti-pattern. To guarantee security and runtime predictability, setups should cleanly isolate target environments depending on compile-time parameters. This guide establishes a compile-time, zero-overhead environment orchestration system leveraging strict encapsulation patterns and modern features in native Dart. 1. Define the Immutable Flavor Domain ( flavor_enum.dart ) The foundation of this pattern relies on an explicit Flavor enumeration. This handles your application's environmental constraints and leverages a resilient static factory fallback to transform incoming build-time string tokens safely into type-safe domains. lib/flavor/flavor_enum.dart Dart /// flavor_enum.dart library; enum Flavor { development, ...