No description
Find a file
Can Arslan 7b4572a413 fix: mock ADB path in tests for CI environments
Add autouse fixture to mock shutil.which so tests pass
in CI environments where ADB is not installed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:57:00 +03:00
.github chore: remove PyPI publishing references 2026-01-30 17:26:19 +03:00
docs feat: restructure project as professional Python package 2026-01-30 17:15:49 +03:00
src/android_emulator_cleaner feat: improve Windows compatibility 2026-01-30 17:33:20 +03:00
tests fix: mock ADB path in tests for CI environments 2026-01-30 17:57:00 +03:00
.gitattributes Initial commit 2026-01-30 17:00:17 +03:00
.gitignore feat: restructure project as professional Python package 2026-01-30 17:15:49 +03:00
.pre-commit-config.yaml feat: restructure project as professional Python package 2026-01-30 17:15:49 +03:00
CHANGELOG.md style: apply ruff formatting to all files 2026-01-30 17:22:19 +03:00
CONTRIBUTING.md feat: restructure project as professional Python package 2026-01-30 17:15:49 +03:00
LICENSE feat: restructure project as professional Python package 2026-01-30 17:15:49 +03:00
Makefile chore: remove PyPI publishing references 2026-01-30 17:26:19 +03:00
pyproject.toml style: apply ruff formatting to all files 2026-01-30 17:22:19 +03:00
README.md docs: update Quick Start section in README 2026-01-30 17:51:52 +03:00
requirements-dev.txt feat: restructure project as professional Python package 2026-01-30 17:15:49 +03:00
requirements.txt feat: restructure project as professional Python package 2026-01-30 17:15:49 +03:00

Android Emulator Cleaner

Android Emulator Cleaner

A beautiful terminal-based utility to clean up Android emulator storage without losing your data

CI PyPI Python Versions License Stars

FeaturesInstallationUsageWhat Gets CleanedScreenshotsContributing


🎯 Overview

Android Emulator Cleaner helps Flutter and Android developers free up valuable disk space consumed by Android emulators without wiping user data. Say goodbye to repeatedly signing into Google accounts after cleaning!

The Problem

Android emulators can quickly consume 10-50GB of disk space through:

  • Accumulated app caches
  • Saved snapshots (Quick Boot)
  • Temporary installation files
  • Screenshots and downloads

The Solution

This tool intelligently cleans temporary and cache files while preserving:

  • Google account sign-in state
  • Installed applications
  • App data (except caches)
  • System settings and preferences

Features

  • 🎨 Beautiful Terminal UI - Rich, colorful interface with progress bars and panels
  • 📱 Multi-Device Support - Clean multiple emulators and physical devices simultaneously
  • 🔧 Selective Cleaning - Choose exactly what to clean with risk indicators
  • 💾 AVD Management - Clean snapshots and cache from stopped emulators
  • 📦 App Uninstallation - Selectively uninstall apps across devices
  • 📊 Storage Monitoring - See before/after storage statistics
  • Zero Data Loss - Preserves accounts, app data, and settings
  • 🐍 Cross-Platform - Works on macOS, Linux, and Windows

📦 Installation

pip install android-emulator-cleaner

Using pipx (Isolated Environment)

pipx install android-emulator-cleaner

From Source

# Clone the repository
git clone https://github.com/CanArslanDev/android_emulator_cleaner.git
cd android_emulator_cleaner

# Install in development mode
pip install -e .

Quick Start (From Source)

# Clone and run directly
git clone https://github.com/CanArslanDev/android_emulator_cleaner.git
cd android_emulator_cleaner
pip install -r requirements.txt
python -m android_emulator_cleaner

🚀 Usage

Command Line

# Run the cleaner
android-emulator-cleaner

# Or use the short alias
aec

As Python Module

python -m android_emulator_cleaner

Programmatic Usage

from android_emulator_cleaner import (
    get_connected_devices,
    DeviceCleaner,
    get_cleanup_options,
)

# Get connected devices
devices = get_connected_devices()

# Clean a specific device
for device in devices:
    cleaner = DeviceCleaner(device)
    options = get_cleanup_options()
    results = cleaner.run_all_cleanups(options)

    for result in results:
        print(f"{result.option.name}: {'✓' if result.success else '✗'}")

🧹 What Gets Cleaned

Running Devices (via ADB)

Category Path Risk Description
🗑️ App Caches /data/data/*/cache 🟢 Low Cache files from all installed apps
📁 Temp Files /data/local/tmp/* 🟢 Low APKs and temp files from installations
📥 Downloads /sdcard/Download/* 🟡 Medium Downloaded files
📸 Screenshots /sdcard/Pictures/Screenshots/* 🟡 Medium Captured screenshots
💾 SD Card Caches /sdcard/Android/data/*/cache/* 🟢 Low External storage app caches

AVD Files (Local)

Category Description
📸 Snapshots Quick Boot snapshots (usually the biggest space saver)
🗑️ Cache Files cache.img files from AVDs

🖼️ Screenshots

Main Menu

Cleanup Options

Results

📋 Requirements

  • Python: 3.10 or higher
  • ADB: Android Debug Bridge (part of Android SDK)
  • Android Emulator: For device cleaning
  • Dependencies: rich, questionary (auto-installed)

Verifying ADB Installation

# Check if ADB is installed
adb version

# If not installed, install via:
# macOS (Homebrew)
brew install android-platform-tools

# Ubuntu/Debian
sudo apt install android-tools-adb

# Or download Android SDK Platform Tools
# https://developer.android.com/studio/releases/platform-tools

🏗️ Project Structure

android_emulator_cleaner/
├── src/
│   └── android_emulator_cleaner/
│       ├── __init__.py          # Package initialization
│       ├── __main__.py          # Module entry point
│       ├── cli.py               # CLI logic and user interaction
│       ├── core/
│       │   ├── __init__.py
│       │   ├── adb.py           # ADB command execution
│       │   ├── avd.py           # AVD file management
│       │   └── cleaner.py       # Cleanup operations
│       ├── models/
│       │   ├── __init__.py
│       │   └── types.py         # Data models and types
│       └── ui/
│           ├── __init__.py
│           ├── console.py       # Console output utilities
│           └── panels.py        # Rich panel components
├── tests/                       # Test suite
├── docs/                        # Documentation
├── .github/workflows/           # CI/CD pipelines
├── pyproject.toml              # Project configuration
├── requirements.txt            # Dependencies
└── README.md                   # This file

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details.

Development Setup

# Clone and enter directory
git clone https://github.com/CanArslanDev/android_emulator_cleaner.git
cd android_emulator_cleaner

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

# Run tests
pytest

# Run linting
ruff check .
mypy src/

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=android_emulator_cleaner --cov-report=html

# Run specific test file
pytest tests/test_adb.py -v

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Rich - Beautiful terminal formatting
  • Questionary - Interactive CLI prompts
  • Android SDK Team - ADB and emulator tools

📬 Support


Made with ❤️ for Android Developers

⬆️ Back to Top