Android Emulator AVD CLI — manage emulators, grant root, run ADB commands
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a94dc73c28f747674b8d6681728ddd7ac3f9bf7b0a4faeca711f0c08d3c30fa3
|
|
| MD5 |
11113cef27d2d7296243afa3a5073fb7
|
|
| BLAKE2b-256 |
90eac5dfff4dac93a003be0b4190acb95033f3b6895c62779d33614210a9540f
|
File details
Details for the file android_avd_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: android_avd_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fec22b25c2ae51355a0351f6bc23515217a5bdce435d4a18081ea5c82e4f2946
|
|
| MD5 |
511ce9c8cf6b8f3e6823b5a145e5e4b8
|
|
| BLAKE2b-256 |
6ab00602566ef5dfa1228fb952e4d8f5e1e2d82c20e7ed6fcdb5552c6d0fd921
|