ADB GUI (PyQt6)
A modern, user-friendly GUI application for Android Debug Bridge (ADB) operations, built with PyQt6.
Works on macOS, Linux, and Windows (ADB + device drivers permitting).
Features
Device Management
- Auto-detect connected Android devices
- View device information (model, manufacturer, Android version, etc.)
- Auto-refresh device list every 5 seconds (silent mode to reduce log spam)
- Device selection with automatic status updates
File Operations
- Push files from PC to Android device
- Pull files from Android device to PC
- File Explorer: browse filesystem, upload/download, drag-and-drop upload
App Management
- Install APK files (supports split APKs)
- Uninstall applications (with fallback to user uninstall for system apps)
- Reinstall apps for current user
- List all installed apps with search functionality
- Enable/disable apps
- Start / stop / force-stop apps
- View app details and package information
Device Operations
- Take screenshots (automatically saved to
screenshots/ folder with timestamps)
- Reboot device (normal, recovery, bootloader)
- Mirror screen with scrcpy (external binary or embedded Python-based mirror)
Seat Connection Management (Enterprise/Work)
- Auto-connect seats via SSH tunnels with gateway jump hosts
- Port forward racks for headend connections
- Seat root file explorer: browse
/data filesystem with root access
- Seat installation wizard: install APKs with fallback staging methods
- Gateway integration: automatic SSH password management via credential store
- History persistence in
~/.cache/adb-seat-ports
Template Commands
- Create reusable one-click command buttons
- Commands support environment variables (
$ADB_PATH, $CURRENT_DEVICE)
- Example:
adb shell "pm list packages | grep com.android"
Shell Commands
- Multi-line textbox for entering complex commands
- Execute ADB shell commands directly on your Android device
- Commands run on Android (Linux), not your desktop OS
- View output in real-time in the log window
Logcat
- View real-time Android logcat output
- Start/stop logcat streaming
- Clear log output
UI Features
- Dark Mode: Toggle between light, dark, and system themes (persistent)
- Modern, clean interface
- Real-time status updates
- Comprehensive logging with timestamps
- Settings persistence (saved to platform-specific AppData location)
Claude Code Integration (MCP Server)
- Headless MCP server (
adb_mcp/) exposing device, seat, and gateway control
- Drive seat devices and read their logs/files as root over the SSH gateway chain
- No PyQt6 dependency — runs alongside the GUI, or entirely without it
- See MCP Server for Claude Code below
Requirements
- Python 3.8+
- PyQt6 (install via
pip install -r requirements.txt)
- ADB (Android Debug Bridge)
- Credential Management (Linux only)
- Android Device with USB debugging enabled
- scrcpy (optional, for screen mirroring)
- macOS (Homebrew):
brew install scrcpy
- Ubuntu:
sudo apt install scrcpy
- Windows: Install via chocolatey or download from releases
- MCP SDK v2 (optional, only for the MCP server)
mcp>=2 — note the v2 rename: FastMCP became MCPServer
- Not needed for the GUI or the frozen app build
- See MCP Server for Claude Code
Installation
Quick Start (macOS / Linux)
git clone <repo-url>
cd GUI-for-Android-Debug-Bridge-ADB-UI
./install.sh # install deps + build a runnable binary
./install.sh --no-build # install deps only
./install.sh --build-only # build only (deps already installed)
./install.sh --run-only # run from source (like python3 adb_gui.py), no build
install.sh detects your OS and architecture, installs the system and Python
dependencies into a local .venv/, then builds the app with PyInstaller.
From Source
- Clone or download this repository
- Install Python 3.8 or higher
- Install dependencies:
pip install -r requirements.txt
- Run it:
python3 adb_gui.py
macOS (Apple Silicon)
install.sh is the recommended path on ARM64 macOS. It:
- Installs Homebrew deps:
scrcpy, ffmpeg, pkg-config, libomp, [email protected]
- Creates a Python 3.12 venv with macOS arm64 wheels
- Installs pinned deps:
PyQt6==6.7.1, py-scrcpy-sdk, opencv-python-headless, paramiko, imageio, pyinstaller
- Builds
dist/ADB Tool.app (native arm64, ad-hoc signed)
Manual equivalent:
brew install scrcpy ffmpeg pkg-config libomp [email protected]
/opt/homebrew/bin/python3.12 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip wheel setuptools
pip install 'PyQt6==6.7.1' 'paramiko>=3.0.0' 'py-scrcpy-sdk>=0.1.2' \
'opencv-python-headless>=4.5.0' 'imageio>=2.34.0' pyinstaller
python -m PyInstaller "ADB Tool.spec" --clean --noconfirm
# Output: dist/ADB Tool.app
Linux (Ubuntu/Debian)
# System dependencies
sudo apt-get update
sudo apt-get install -y \
python3.12 python3.12-venv python3.12-dev \
libgl1-mesa-glx libglib2.0-0 libsecret-1-0 libsm6 libxext6 libxrender1 \
ffmpeg pkg-config libomp-dev adb libpixman-1-0 libcairo2
# Python virtual environment
python3.12 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip wheel setuptools
pip install 'PyQt6>=6.6.0' 'paramiko>=3.0.0' 'py-scrcpy-sdk>=0.1.2' \
'opencv-python-headless>=4.5.0' 'imageio>=2.34.0' pyinstaller
# Build
python -m PyInstaller --name "ADB_Tool" --windowed --onefile --clean \
--collect-all py_scrcpy_sdk \
--collect-all av \
--collect-all imageio \
--exclude-module cv2 \
adb_gui.py
# Output: dist/ADB_Tool
Verify the install:
python -c "
from PyQt6.QtCore import QT_VERSION_STR; print(f'PyQt6 {QT_VERSION_STR}')
import py_scrcpy_sdk, av, numpy, imageio, paramiko
print('All imports OK')
"
Windows (10/11)
Run as Administrator in PowerShell:
# Python 3.12 (from Microsoft Store or https://python.org)
winget install Python.Python.3.12 -e
# Restart the terminal, then verify:
py --version # should show 3.12.x
# ADB: download Android Platform Tools
# https://developer.android.com/studio/releases/platform-tools
# Extract to C:\Android\platform-tools and add to PATH:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Android\platform-tools", "Machine")
# scrcpy (optional, for external mirroring)
# https://github.com/Genymobile/scrcpy/releases -> extract to C:\scrcpy, add to PATH
# Python virtual environment
py -3.12 -m venv .venv
.venv\Scripts\activate
pip install --upgrade pip wheel setuptools
pip install 'PyQt6>=6.6.0' `
'paramiko>=3.0.0' `
'py-scrcpy-sdk>=0.1.2' `
'opencv-python-headless>=4.5.0' `
'imageio>=2.34.0' `
'pyinstaller'
# Build
python -m PyInstaller --name "ADB_Tool" --windowed --onefile --clean `
--collect-all py_scrcpy_sdk `
--collect-all av `
--collect-all imageio `
--exclude-module cv2 `
adb_gui.py
# Output: dist\ADB_Tool.exe
Usage
-
Enable USB debugging on your Android device:
- Go to Settings → About Phone
- Tap “Build Number” 7 times to enable Developer Options
- Go to Settings → Developer Options
- Enable “USB Debugging”
-
Connect your Android device via USB
-
Run the application:
- From a built binary:
open dist/ADB Tool.app (macOS) or ./dist/ADB_Tool (Linux)
- From source:
python3 adb_gui.py
-
ADB auto-detection (recommended):
- The app will try to find
adb automatically via your PATH (and common SDK/Homebrew locations on macOS).
- If it cannot find ADB, it will prompt you to select it.
- You can always change it later using the “ADB Path” button.
-
Select your device from the dropdown (devices auto-refresh every 5 seconds)
-
Use the various buttons to perform ADB operations
Seat Connection Management
For enterprise/work environments, the app supports seat connections through SSH tunnels:
First-Time Setup (Migration Wizard)
On first startup, the wizard appears to:
- Import seat/portforward commands from your shell history (
bash_history, zsh_history, fish_history)
- Offer to copy bundled
seat.sh and portforwardRack.sh scripts to ~/
- Show discovered connections for import
Bundled Scripts
The app ships with seat.sh and portforwardRack.sh scripts embedded. These are:
- Deployed to
~/.cache/adb-gui-ui/scripts/ on startup
- Copied to
~/seat.sh and ~/portforwardRack.sh when you accept the migration offer
- Used for seat connections, port forwards, and tunnel management
Gateway Integration
- SSH passwords are stored in OS credential stores (macOS Keychain, Windows Credential Manager, or file fallback on Linux)
- Gateways are cached per session for efficient reconnection
- Automatic fallback to
bct (bundle copy tool) for gateway transfers when direct scp fails
Seat Root File Explorer
- Browse
/data filesystem with root access
- Upload/download files with base64 heredoc streaming
- On-demand write-permission checks
MCP Server (for Claude Code)
adb_mcp/ exposes the ADB Tool’s capabilities to Claude Code over the
Model Context Protocol, so an AI assistant
can drive your devices and seats directly — list apps, pull screenshots, tap
through screens, read logs off a seat as root, and move files around.
It talks to the shared adb server, not to the GUI process. When the GUI
connects a seat, the device appears in the adb daemon’s device list as
localhost:<port>, which is process-global — so the MCP server sees it
immediately, with no IPC between the two. The GUI and the MCP server can run
at the same time, or not at all.
The MCP server has no PyQt6 dependency and is not part of the frozen
app build.
Setup
One-time setup (uses uv; pip works too):
uv venv .venv-mcp --python 3.12
uv pip install --python .venv-mcp/bin/python "mcp>=2" paramiko pillow
Then register the server with Claude Code:
claude mcp add adb-tool --scope project -- ./adb_mcp/run.sh
run.sh pins the working directory to the repo root so the server can import
adb_tool and read the same settings.json and seat history as the GUI. It
picks .venv-mcp/bin/python first, then .venv/bin/python, then python3.
To pin a default device at registration time:
claude mcp add adb-tool --scope project \
--env ADB_MCP_DEVICE=localhost:64491 \
-- ./adb_mcp/run.sh
Check that it works:
.venv-mcp/bin/python -m adb_mcp --list-tools # print the tool list
paramiko is only needed for the gateway_* and seat_root_* tools.
pillow is only needed for screenshot(max_width=...) — without it the
screenshot still works, just at full resolution.
Choosing a device
Most tools take an optional device argument. When omitted, the pinned
default is used. Resolution order:
ADB_MCP_DEVICE environment variable
ADB_GUI_CURRENT_DEVICE environment variable
default_device in mcp_config.json in the app-data directory
last_device in settings.json
The app-data directory is ~/Library/Application Support/ADB-GUI-UI on macOS,
%APPDATA%/ADB-GUI-UI on Windows, ~/.config/ADB-GUI-UI on Linux. Call
list_devices to see what is connected and which one is the default, and
set_default_device to change it for the session.
The tools are grouped by area:
| Area |
Tools |
| Devices |
list_devices, device_info, set_default_device |
| Shell & input |
shell, input_text, input_tap, input_swipe, input_key |
| UI inspection |
ui_dump, ui_find, ui_tap, ui_scroll, screen_size |
| Screenshot |
screenshot (returns an image) |
| Files & apps |
list_files, push_file, pull_file, delete_file, list_packages, install_apk, uninstall_app, launch_app, app_status |
| Logcat |
logcat |
| Seats |
list_seats, seat_status, connect_seat, disconnect_seat, reconnect_seat |
| Seat root |
seat_root_ls, seat_root_cat, seat_root_run, seat_root_pull, seat_root_push |
| Gateways |
list_gateways, gateway_ls, gateway_cat, gateway_run, gateway_upload, gateway_download, gateway_mkdir, gateway_remove |
| Mirroring |
mirror_start, mirror_stop, mirror_status |
Full tool documentation is in adb_mcp/README.md.
Prompt Examples
Find a button and tap it. ui_find returns tap coordinates, ui_tap does
find-and-tap in one step (more reliable on a scrolling screen, because the
coordinates can’t go stale between the lookup and the tap):
Find the yellow “Enter” button and tap it.
List the UI elements on screen, then tap the one labelled “Sign in”.
Scroll to find something and open it:
Scroll down until you see a movie called “Inception”, then tap it.
Check what’s on the device:
Take a screenshot and tell me what app is in the foreground.
List all installed third-party apps and their versions.
What’s the battery level and how much free storage is there?
Pull a log off a seat as root. The seat_root_* tools reach a seat over
the SSH chain gateway → bct login → su -, so this is the same root access
the GUI’s Seat Root Explorer has:
Connect to seat 172.17.144.5 on the excite gateway and show me what’s in
/var/log/screen.info.
List /data/system/dropbox on the seat and read the newest crash report.
Grep the seat’s uiderrors.txt for “1000” — don’t pull the whole file.
Run logcat -d -b crash on the seat as root and show me the last 50 lines.
Move files around:
Upload ~/Downloads/test.apk to the seat’s /data/local/tmp.
Download /data/local/tmp/t.png from the seat to my Desktop.
Upload build.zip to the gateway at /tmp/ and list what’s there.
Copy that file from the gateway down to my machine.
Seat and gateway housekeeping:
Which seats are connected right now?
Connect to seat 172.17.152.5 through user@excite-miat.
Run docker ps on the excite gateway.
What tools are available on the gateway?
Notes and limits
- Credentials are never prompted for. The gateway, mtc and root passwords
come from the OS credential store (macOS Keychain, Windows Credential
Manager, or the Linux file fallback) — the same place the GUI saves them.
Save them in the GUI first; a missing credential comes back as a readable
error, not a hang.
- The embedded (py-scrcpy-sdk) mirror cannot be driven from the MCP
server — it renders into a Qt window owned by the GUI process.
mirror_start uses the native scrcpy binary instead.
- The MCP server cannot reach GUI-only state (the GUI’s currently-selected
device, button spinners, in-app dialogs). It works at the adb and SSH
level.
- Screenshots on network seats are slow. A 4K seat PNG is ~7 MB and can
take over two minutes over the tunnel. Use
screenshot(max_width=1080) to
downscale, and mirror_start if you want a live view.
How It Works
ADB Path Selection
- The app first attempts to auto-detect
adb (PATH + common locations)
- If auto-detection fails, it will prompt you to select the
platform-tools folder or the adb executable
- The selected path is saved to
settings.json for persistence
Settings Persistence
- Settings are saved to platform-specific AppData locations:
- macOS:
~/Library/Application Support/ADB-GUI-UI/settings.json
- Windows:
%APPDATA%/ADB-GUI-UI/settings.json
- Linux:
~/.config/ADB-GUI-UI/settings.json
- Seat history:
~/.cache/adb-seat-ports
- Portforward history:
~/.cache/portforward-racks
Screenshots
- Screenshots are automatically saved to the
screenshots/ folder in the project directory
- Filenames include timestamps:
screenshot_YYYYMMDD_HHMMSS.png
APKs Folder
- Pulled APKs are saved to the
apks/ folder in the project directory
- Useful for backing up apps before uninstalling
Scrcpy Integration
The app supports two scrcpy modes:
-
External Binary (recommended):
- Uses system-installed
scrcpy
- Full feature support
-
Embedded Mirror (optional, requires extra deps):
- Pure Python solution using
py-scrcpy-sdk
- Requires:
py-scrcpy-sdk, opencv-python-headless, imageio
- Also needs
ffmpeg + pkg-config on macOS
Features in Detail
Device Selection
- Devices are automatically detected and listed
- Device status (device, offline, unauthorized) is shown
- Click “Info” to see detailed device information
File Transfer
- Push: Select a file from your PC and specify destination path on device
- Pull: Specify file path on device and choose where to save on PC
- File Explorer:
- Browse the device filesystem (starts at
/sdcard)
- Double-click folders to navigate
- Upload via button or drag-and-drop files from your computer
App Management
- Install APK: Browse and install APK files (supports split APKs)
- Uninstall: Select from installed apps list or enter package name
- List Apps: View all installed packages with:
- Search functionality (by app name or package)
- Filter to show only disabled apps
- Uninstall, reinstall, enable/disable, start/stop/force-stop actions
- Double-click to view app details
Template Commands
Create reusable command buttons in the header:
adb shell "dumpsys battery | grep level"
$ADB_PATH -s $CURRENT_DEVICE shell "dumpsys deviceidle"
Screen Mirroring (scrcpy)
- Click “🪞 Mirror Screen (scrcpy)” to mirror the currently selected device
- If
scrcpy is not found, the app will suggest installing it
- Note: Some scrcpy builds don’t support a custom
--adb option; the app will auto-fallback if needed
Logcat
- Click “Start Logcat” to begin streaming Android logs
- Click “Stop Logcat” to stop streaming
- Click “Clear” to clear the log output
- Logs appear in real-time in the output window
Known Issues
- Logcat not working: The logcat feature may not display output correctly on some devices. Workaround: Use shell commands to view logs manually (e.g.,
logcat -d).
Troubleshooting
No devices found:
- Ensure USB debugging is enabled on your device
- Check USB cable connection
- Try different USB port
- On device, check for “Allow USB debugging?” prompt and accept it
- Run
adb devices in a terminal to verify ADB can see your device
ADB not found:
- The app tries to auto-detect
adb via PATH and common SDK locations
- If it still can’t find it, use the “ADB Path” button to set it
- Make sure you select the
platform-tools folder (contains adb) or the adb executable itself
Permission denied errors:
- Some operations require root access on the device
- Try enabling “Root access” in Developer Options (if available)
Seat connection issues:
- Check that
seat.sh is in your PATH or set via Settings
- Verify gateway credentials are saved in your credential store
- Check the log window for SSH error details
scrcpy not found:
- Install scrcpy and try again
- macOS (Homebrew):
brew install scrcpy
- Ubuntu:
sudo apt install scrcpy
Logcat not showing output:
- Make sure a device is selected
- Check the log output for error messages
- Verify ADB connection: Try running a simple shell command first
- Some devices may require root access for full logcat output
pip: “SSLCertVerificationError: certificate is expired”
WARNING: Retrying ... after connection broken by 'SSLError(SSLCertVerificationError('"*.pythonhosted.org" certificate is expired'))'
error: ssl-verification-failed
This is a transient PyPI CDN (Fastly) certificate rotation, not a problem with
your machine. During rotation, PyPI’s edges briefly serve a leaf certificate that
has just expired, and every download attempt fails verification.
install.sh handles this automatically: it retries pip installs with exponential
backoff (10s → 20s → 40s, up to 4 attempts) and runs a TLS pre-flight check against
pypi.org before touching the venv, so you get a clear message instead of a wall
of pip errors.
If it still fails, just wait a few minutes and re-run. To check the current state:
curl -sI https://pypi.org/simple/ | head -1
If you’re behind a corporate proxy that intercepts TLS, point pip at your proxy’s
CA bundle rather than disabling verification:
export PIP_CERT=/path/to/company-ca.pem
Never use --trusted-host here — it disables certificate verification for every
package and would hide a genuine interception.
macOS: “Class AVFFrameReceiver is implemented in both…”
This is a benign warning during build. The cv2 stub in scrcpy_mirror.py prevents the crash at runtime by replacing real cv2 with a stub before py_scrcpy_sdk loads.
macOS: Qt 6.11 QMessageBox crash
Fixed by pinning PyQt6==6.7.1 in requirements/platform checks.
Linux: libsecret not found
Install libsecret-tools (libsecret-1-0 package on Debian/Ubuntu) for SSH credential storage.
MCP: “No stored password for user@host”
The MCP server never prompts for credentials — it reads the OS credential
store, which is the same place the GUI saves them. Open the ADB Tool GUI and
save the gateway / mtc / root password there, then retry.
MCP: “No device specified and no default device is pinned”
Either pass an explicit device argument to the tool, set ADB_MCP_DEVICE
in the MCP server’s environment, or call list_devices to see what is
connected.
MCP: seat reported offline or unreachable
The seat history records the gateway each seat was last reached through —
~/.cache/adb-seat-ports. A seat reachable via one gateway is often
unreachable via another, so pass the matching gateway explicitly. Check
which pairing to use with:
grep <seat-ip> ~/.cache/adb-seat-ports
Windows: adb not found
Ensure Android Platform Tools is in your PATH, or configure ADB path in Settings dialog.
File Structure
ADB GUI/
├── adb_gui.py # Main application (legacy monolith)
├── requirements.txt # Python dependencies
├── settings.json # Legacy settings (not used at runtime)
├── screenshots/ # Screenshot storage (auto-created)
├── apks/ # Pulled APK storage (auto-created)
├── icons/ # Application icons (macOS, Windows, Linux)
├── generate_icon.py # Script to regenerate icons
├── install.sh # One-shot dependency install + build (macOS/Linux)
├── ADB Tool.spec # PyInstaller spec (macOS .app bundle)
├── .mcp.json # MCP server registration for Claude Code
├── .github/workflows/
│ └── build.yml # CI/CD workflow for releases
├── adb_mcp/ # Headless MCP server (no PyQt6)
│ ├── server.py # Tool registration + entry point
│ ├── context.py # Shared state: adb path, settings, credentials
│ ├── device_tools.py # Device control (shell, files, apps, logcat)
│ ├── ui_tools.py # UI inspection (ui_dump, ui_find, ui_scroll)
│ ├── seat_tools.py # Seat connect/disconnect/reconnect
│ ├── seat_root_tools.py # Seat root access over SSH (ls, cat, run, pull, push)
│ ├── gateway_tools.py # Gateway SSH/SFTP (ls, cat, run, upload, download)
│ ├── mirror_tools.py # Native scrcpy mirror control
│ └── run.sh # Launcher used by the MCP client
└── adb_tool/ # Modular package (new structure)
├── __init__.py # Package init
├── constants.py # Constants and paths
├── adb_manager.py # ADB command execution
├── seat_manager.py # Seat/portforward management
├── seat_methods.py # Seat operations mixin
├── seat_ssh.py # Seat SSH machinery (no Qt — shared with MCP server)
├── gateway_methods.py # Gateway operations mixin
├── scrcpy_methods.py # Scrcpy operations mixin
├── app_methods.py # App operations mixin
├── device_methods.py # Device operations mixin
├── file_methods.py # File operations mixin
├── theme_methods.py # Theming mixin
├── settings_dialog.py # Settings UI
├── migration_wizard.py # First-run wizard
├── bundled_scripts.py # Embedded seat.sh & portforwardRack.sh
├── credentials.py # SSH credential management
├── ssh_config.py # ~/.ssh/config ProxyCommand parser (no Qt)
├── crash_handler.py # Crash reporting
├── safe_dialog.py # Crash-safe dialog helpers
├── logging_methods.py # Logging mixin
├── ui_widgets.py # Custom Qt widgets
├── scrcpy_mirror.py # Embedded scrcpy mirror
├── scrcpy_canary.py # Scrcpy dependency checker
├── seat_root_explorer.py # Root file explorer
├── stress_tester.py # Stress testing utilities
Optional: App Icon
If you add an icon file next to adb_gui.py, it will be used automatically:
icon.icns (macOS)
icon.png / icon.jpg
Building
There are two ways to build locally, in increasing order of automation:
| Path |
Use when |
Produces |
./install.sh |
First-time setup on macOS/Linux |
deps + dist/ADB Tool.app or dist/ADB_Tool |
python -m PyInstaller ... |
You already have deps installed |
same as above, per the commands below |
install.sh — one-shot install + build
Installs system deps, creates .venv/, installs Python deps, then runs
PyInstaller. macOS and Linux are fully automated; on Windows it prints the
PowerShell commands (see Windows setup).
./install.sh # deps + build
./install.sh --no-build # deps only
./install.sh --build-only # build only
./install.sh --run-only # run from source, no build
./install.sh --clear-cache # drop the dependency cache, force a full re-check
--run-only skips both the dependency install and the build and launches
adb_gui.py directly, preferring the project .venv/ when it exists (so the
installed dependency set is used) and falling back to system python3
otherwise. Extra arguments can be forwarded to the app after --:
./install.sh --run-only -- --debug # isolated temporary session
Dependency cache
install.sh caches what it installed in .install-cache (gitignored) so
repeat runs don’t redo the expensive work. On a warm cache the whole
dependency phase takes about a second instead of re-creating the virtualenv
and re-resolving every wheel against PyPI.
The cache records a fingerprint of the OS/arch, the pinned dependency specs,
and the contents of requirements.txt and install.sh. It is invalidated
automatically when any of those change.
A cache hit is never taken on trust — every run re-verifies that the
dependencies are still present:
- system dependencies are probed with
brew --prefix / command -v
- Python dependencies are resolved offline with
pip install --dry-run --no-index, which checks the actual installed
versions against the pins without touching the network
So uninstalling a package, downgrading one below its pin, or deleting
.venv is always detected and repaired — the cache only skips work that is
genuinely already done. Use --clear-cache to force a full re-check.
Direct PyInstaller commands
If you prefer invoking PyInstaller directly:
macOS — .app bundle via the hand-written spec (native arm64, ad-hoc signed, includes the full adb_tool/ package as datas for the scrcpy canary):
python -m PyInstaller "ADB Tool.spec" --clean --noconfirm
Single-File Executable (Windows/Linux):
python -m PyInstaller --name "ADB_Tool" --windowed --onefile --clean \
--collect-all py_scrcpy_sdk \
--collect-all av \
--collect-all imageio \
--exclude-module cv2 \
adb_gui.py
The --collect-all flags ship the lazily-imported embedded-mirror deps
(py_scrcpy_sdk + its bundled scrcpy-server asset, PyAV’s FFmpeg libs,
imageio). Without them the frozen binary always shows the “Install
Dependencies” dialog when mirroring. cv2 is excluded because the app stubs
it in-process to avoid the PyAV libavdevice duplicate-class crash.
install.sh also runs a pre-flight check for these deps before building and
fails loudly if any are missing from the build environment — --collect-all
on an uninstalled package collects nothing, so the build would otherwise
“succeed” and ship a binary that can’t mirror.
Build output lands in dist/:
- macOS:
dist/ADB Tool.app (plus an onedir dist/ADB Tool/)
- Linux/Windows:
dist/ADB_Tool / dist/ADB_Tool.exe
CI Builds
The GitHub Actions workflow (.github/workflows/build.yml) builds on windows-latest, macos-latest, and ubuntu-latest, and publishes a GitHub Release when a v* tag is pushed. It invokes pyinstaller directly and is the source of truth for release builds.
Development
Package Structure
The codebase is being refactored from a monolithic adb_gui.py into a modular adb_tool package:
adb_tool/
├── constants.py # App constants, paths, debug mode
├── credentials.py # SSH credential management
├── adb_manager.py # ADB command execution
├── seat_manager.py # Seat/portforward connections
├── ui_widgets.py # Custom Qt widgets
├── settings_dialog.py # Settings configuration UI
├── migration_wizard.py # First-run history import
├── crash_handler.py # Crash reporting utilities
├── scrcpy_mirror.py # Embedded screen mirror
└── ... (more modules)
Threading Model
- Long-running operations use
threading.Thread(target=do_*, daemon=True).start()
- UI updates from background threads must use
QTimer.singleShot(0, lambda: ...) or self._ui_caller.call.emit(fn)
log() and log_to_logcat() are thread-safe entry points
Adding New Features
- For UI changes: Edit
adb_gui.py (UI setup) or appropriate mixin in adb_tool/
- For ADB operations: Use
self.adb.run_command() from the appropriate mixin
- For long-running operations: Run in a background thread with proper UI marshaling
- For new settings: Add keys to
ADBGUI.__init__() and load_settings()
The MCP server in adb_mcp/ is the headless counterpart of the GUI. To
expose a new capability:
- Put the logic in
adb_tool/ — without Qt if the MCP server is to use
it. adb_tool/seat_ssh.py and adb_tool/ssh_config.py are the pattern:
Qt-free modules that both the GUI mixins and the MCP tools import.
- Add a plain function taking
(ctx, ...) in the relevant
adb_mcp/*_tools.py module. ctx (see adb_mcp/context.py) gives you the
adb path, the loaded settings.json, the CredentialManager and the
SeatPortManager.
- Register it in
adb_mcp/server.py with @server.tool(description=...).
Write the description for the model — say when to use the tool, not just
what it does.
- Document it in
adb_mcp/README.md and add a row to the table in the root
README.
Return a readable string. Errors should be "ERROR: ..." strings rather than
exceptions — the model can act on a message, but it can’t read a traceback.
Testing
No automated test suite is configured. To test:
- Run the app from source
- Test manually with a connected device
- Check the log window for errors
License
This project is open source and available for personal and commercial use.
Contributing
Feel free to submit issues, fork the repository, and create pull requests for any improvements.
Credits
- Built with PyQt6
- Screen mirroring powered by scrcpy
- Seat connection management with custom bash scripts
- Icon generated with IconGenerator
评论