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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

android_avd_cli-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

android_avd_cli-0.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file android_avd_cli-0.1.0.tar.gz.

File metadata

  • Download URL: android_avd_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for android_avd_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a94dc73c28f747674b8d6681728ddd7ac3f9bf7b0a4faeca711f0c08d3c30fa3
MD5 11113cef27d2d7296243afa3a5073fb7
BLAKE2b-256 90eac5dfff4dac93a003be0b4190acb95033f3b6895c62779d33614210a9540f

See more details on using hashes here.

File details

Details for the file android_avd_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for android_avd_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fec22b25c2ae51355a0351f6bc23515217a5bdce435d4a18081ea5c82e4f2946
MD5 511ce9c8cf6b8f3e6823b5a145e5e4b8
BLAKE2b-256 6ab00602566ef5dfa1228fb952e4d8f5e1e2d82c20e7ed6fcdb5552c6d0fd921

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page