Install & Compatibility
Where this runs
tested against v4.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 28.5MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 2.5s · import 0.000s · 29MB
25MB installed
● package 25MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ADBDevice
✓ from mozdevice import ADBDevice
✗ from mozdevice.devicemanager import DeviceManager
This quickstart connects to a locally available Android device via ADB, retrieves basic device information, and lists installed packages. Ensure ADB (Android Debug Bridge) is installed and configured in your system's PATH, and a device is connected and authorized.
import os
from mozdevice.devicemanager import DeviceManager
try:
# Connect to a locally available ADB device
# If multiple devices are connected, you might need to specify 'serial'
dm = DeviceManager()
print(f"Connected to device: {dm.name}")
print(f"Device type: {dm.device_type}")
print(f"Device OS: {dm.os}")
# Example: Get a list of installed packages (Android)
if dm.os == 'android':
packages = dm.list_packages()
print(f"Number of installed packages: {len(packages)}")
# print(f"Sample packages: {packages[:5]}")
except Exception as e:
print(f"Error connecting or interacting with device: {e}")
print("Please ensure ADB is installed and a device is connected and authorized.")
Debug
Known issues
gotchaMozdevice relies on ADB (Android Debug Bridge) being installed and accessible in your system's PATH. Without a correctly set up ADB environment, device connection will fail.fixInstall Android SDK Platform-Tools (which includes ADB) and ensure its location is added to your system's PATH environment variable. Verify with `adb devices` command.
affects: All versions
breakingThe minimum Python version required is 3.6. While PyPI metadata might sometimes show `None` for `requires_python`, the project's `setup.cfg` explicitly states `>=3.6`.fixEnsure you are using Python 3.6 or a newer version (e.g., `python3.9 -m pip install mozdevice`).
affects: <4.0 (for older Python), >=4.0 (strictly Python 3.6+)
gotchaConnecting to specific devices when multiple are present or connecting to remote devices requires specifying connection parameters (e.g., `serial`, `addr`, `port`) during `DeviceManager` initialization.fixInitialize `DeviceManager` with `DeviceManager(serial='<DEVICE_SERIAL>')` for specific local devices, or `DeviceManager(addr='<REMOTE_IP>', port=<REMOTE_PORT>)` for remote connections. Use `adb devices` to find local device serials.
affects: All versions
Upgrade
Version history
4.2.0latest on PyPI · released Nov 7, 2024
Audit
Dependencies
manifest-parserrequiredRequired for parsing application manifests (e.g., Firefox OS apps).