Skip to main content

android-cli

Android Emulator AVD CLI — manage emulators, grant root via Magisk, and run ADB commands from the terminal.

pip install android-cli

Quick Start

# List available AVDs
android list

# Boot an emulator (headless by default)
android boot rooted-playstore33

# Wait for boot, then auto-grant root via Magisk
android root

# Check device info
android info

# Run ADB shell commands
android shell pm list packages

# Stop the emulator
android kill

Installation

pip install android-cli

Or install from source:

git clone https://github.com/overtimepog/android-cli.git
cd android-cli
pip install -e .

Prerequisites

  • Android SDK with platform tools and a system image installed
  • An AVD created (via Android Studio CLI or avdmanager)
  • For root features: a Magisk-patched system image

Commands

Command Description
android list List all available AVDs
android boot <avd> Boot an AVD (headless by default)
android status [avd] Show running emulators
android root [avd] Auto-grant root via Magisk
android kill [avd] Stop emulator(s)
android shell <cmd> Run ADB shell commands
android info [avd] Get device properties
android snapshot <list|save|delete> Manage snapshots
android sdk-path Show detected Android SDK path

Boot Options

# Show the emulator window
android boot <avd> --headed

# Skip snapshots (clean boot)
android boot <avd> --no-snapshot

# Wipe user data
android boot <avd> --wipe-data

# Boot read-only
android boot <avd> --read-only

# Wait for boot to complete
android boot <avd> --wait

# Boot, wait, and auto-grant root
android boot <avd> --root

# Boot with longer timeout
android boot <avd> --wait --timeout 300

# Pass extra emulator flags
android boot <avd> -X "-memory" -X "2048" -X "-cores" -X "4"

How Root Grant Works

When a Magisk-patched emulator boots for the first time, su -c opens a dialog in the Magisk app asking for approval. Since the emulator runs headless, android root:

  1. Triggers a su request to open the dialog
  2. Tries multiple key-event patterns to auto-approve (Tab→Tab→Enter, Tab→Down→Down→Enter, etc.)
  3. Retries with alternative patterns if the first attempt fails
  4. Verifies root access was granted

Root Options

# Basic root grant
android root

# Check root status without triggering dialog
android root --check

# Grant root with "Remember" checkbox checked
android root --persist

# Retry with up to 5 attempts
android root --retries 5

# Boot and auto-grant in one step
android boot <avd> --root

SDK Detection

The tool auto-detects the Android SDK by checking (in order):

  1. --sdk CLI flag
  2. ANDROID_HOME environment variable
  3. ANDROID_SDK_ROOT environment variable
  4. Common paths (~/Library/Android/sdk, ~/Android/Sdk)
  5. emulator on PATH

Requirements

  • Python 3.8+
  • Android SDK (emulator must be on PATH or SDK root set)
  • ADB (platform-tools)

License

MIT

Metadata

Release files for android-avd-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for android-avd-cli 0.1.0
File Size Uploaded
android_avd_cli-0.1.0.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for android-avd-cli 0.1.0
File Interpreter ABI Platform
android_avd_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / android_avd_cli-0.1.0.tar.gz

Download URL android_avd_cli-0.1.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a94dc73c28f747674b8d6681728ddd7ac3f9bf7b0a4faeca711f0c08d3c30fa3
BLAKE2b-256 checksum
How to use checksums
90eac5dfff4dac93a003be0b4190acb95033f3b6895c62779d33614210a9540f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / android_avd_cli-0.1.0-py3-none-any.whl

Download URL android_avd_cli-0.1.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fec22b25c2ae51355a0351f6bc23515217a5bdce435d4a18081ea5c82e4f2946
BLAKE2b-256 checksum
How to use checksums
6ab00602566ef5dfa1228fb952e4d8f5e1e2d82c20e7ed6fcdb5552c6d0fd921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page