This document explains how to install, configure, and use ADB (Android Debug Bridge) on Windows, macOS, and Linux for both physical devices and cloud phones.
ADB is the official Android debugging bridge tool. It supports device connection, app installation, log viewing, file transfer, and port forwarding.
Core components:
Client: The adb command you run in your terminal.
Server: A local background process, usually listening on port 5037.
Daemon (adbd): A daemon process running on Android devices.
Ensure your terminal can access the internet to download Android SDK Platform-Tools.
Use official platform-tools whenever possible.
For physical phones, enable Developer Options and USB debugging.
Download and unzip Android SDK Platform-Tools (recommended path: C:\platform-tools).
Set environment variables:
Add C:\platform-tools to system Path.
Open PowerShell / CMD and run:
adb version
If version output appears, installation is successful.
When connecting a phone by USB for the first time, allow the USB debugging prompt on the device.
Method 1 (recommended): install platform-tools via Homebrew:
brew install android-platform-tools
Method 2: download the official archive, extract it, and add the directory to PATH.
Verify installation:
adb version
If you see permission/path issues, reopen terminal or check ~/.zshrc / ~/.bashrc.
Ubuntu / Debian:
sudo apt update && sudo apt install -y android-sdk-platform-tools
CentOS / RHEL (may require EPEL or manual package):
Recommended: install official platform-tools manually.
Verify installation:
adb version
If USB permission fails, add udev rules and reload.
Start ADB server:
adb start-server
List devices:
adb devices
Status meanings:
device: ready; unauthorized: not authorized; offline: connection problem.
LAN connection example:
adb connect 192.168.1.10:5555
Run adb devices and confirm status is device.
Cloud phone via SSH tunnel:
Create tunnel:
ssh user@host -p 1824 -L 8767:adb-proxy:53398 -Nf
Connect locally:
adb connect localhost:8767
Note: local port is the left side of -L (here 8767).
List devices: adb devices -l
Open shell: adb shell
Install APK: adb install app.apk
Reinstall APK: adb install -r app.apk
Uninstall app: adb uninstall package.name
View logs: adb logcat
Push file: adb push localfile /sdcard/
Pull file: adb pull /sdcard/file localdir
Port forward: adb forward tcp:7001 tcp:7001
Disconnect: adb disconnect
When multiple devices are online, use -s with serial number:
adb -s SERIAL shell
adb -s SERIAL install -r app.apk
adb: command not found
Check installation and Path, then reopen terminal.
unauthorized
Allow USB debugging on device; run adb kill-server && adb start-server if needed.
offline
Run adb disconnect, reconnect, and check network/port reachability.
Port already in use
Change local port (for example -L 8768:...) and use adb connect localhost:8768.
ADB server abnormal
Restart with adb kill-server and adb start-server, then check adb devices.
Pin ADB version for automation environments.
Always use -s in multi-device scripts.
For cloud phones, prefer SSH tunnel instead of exposing debug ports directly.
Close tunnels and idle sessions when no longer needed.
Note: Use ADB only on devices you are authorized to manage.