Android Debug Bridge (adb
)
Android Debug Bridge (adb
) is a versatile command-line tool that lets you communicate with a device. The adb
command facilitates a variety of device actions, such as installing and debugging apps. adb
provides access to a Unix shell that you can use to run a variety of commands on a device. It is a client-server program that includes three components:
- A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an
adb
command. - A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
- A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.
Setup Guide
Setting up adb
Windows
- Obtain the
adb
Platform Tools from the official Android developer website. - Unzip the
platform-tools-latest-windows.zip
file and navigate to the extracted folder. - Within the folder, access the Command Prompt by typing
cmd
in the File Explorer’s address bar and pressing Enter.
Direct navigation to the folder is required unless you have added the directory to your Environment Variables, which is detailed later in this guide.
Android
- Enable Developer Options and USB/Wireless debugging:
- Navigate to
Settings > About phone
. - Tap
Build number
seven times until the message “You are now a developer!” appears. - Access
Developer Options
. - Enable
USB debugging
orWireless debugging
, depending on your preference.
- Navigate to
USB debugging
- Execute
adb devices
in the Command Prompt. - If prompted on your phone, select “Always allow from this computer” and confirm.
Wireless debugging
- In
Developer Options
, selectWireless debugging
and choosePair with a code
. - Execute
adb pair <ip-address>:<port>
using the provided IP address and port. - Enter the pairing code when prompted in the terminal.
For multiple devices connected, use the device serial number with commands, e.g., adb -s <serial-number> <command>
.
Android TV
- Enable
Developer Options
andUSB debugging
. - Locate the option according to your TV manufacturer’s settings.
- Connect via
adb connect <ip-address>
, using the IP address from the TV’s Wi-Fi settings.
Storage Backup & Restore
- Open Command Prompt and run
adb devices
to list connected devices. - Use
adb pull -a /sdcard <destination-path>
to copy the entire internal storage. The-a
flag preserves file attributes. - Set up
adb
on the target device and connect it to your computer. - Push the data using
adb push <source-folder>\. /sdcard
, e.g.,adb push "D:\My phone\sdcard\." /sdcard
. - Upon completion of the necessary
adb
operations, execute the commandadb kill-server
. This will terminate theadb
service.
Installing APK Files
- Use reputable sources like APKMirror, UpToDown, or APKPure to download APK files.
- With the device connected, execute
adb install <apk-filename>
from the directory containingadb.exe
and the APK file. You may also specify the full path to the APK file if it is located in a different directory.
Setting Environment Variables
Making an environment variable will make adb
accessible from any location in the terminal. To make an environment variable for adb
:
- In the Start Menu, search for
Edit the system environment variables
. - Open
Edit the system environment variables
and navigate toEnvironment Variables...
. - Under
System variables
, select thePath
variable and clickEdit
. - Add the directory containing
adb.exe
using theNew
orBrowse
options. - Confirm all dialogs with
Ok
.
For further assistance or advanced configurations, consult the official Android Debug Bridge documentation.
Also, check out the FMHY Discord to learn, share and connect with the great developers.