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:
- Triggers a
surequest to open the dialog - Tries multiple key-event patterns to auto-approve (Tab→Tab→Enter, Tab→Down→Down→Enter, etc.)
- Retries with alternative patterns if the first attempt fails
- 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):
--sdkCLI flagANDROID_HOMEenvironment variableANDROID_SDK_ROOTenvironment variable- Common paths (
~/Library/Android/sdk,~/Android/Sdk) emulatoron 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)
| File | Size | Uploaded | |
|---|---|---|---|
| android_avd_cli-0.1.0.tar.gz | 12.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|