Android debug bridge
lastmod 2025-11-07created 2015-10-194 edits
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:
- A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
- A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
- A daemon, which runs as a background process on each emulator or device instance.
You can find the adb tool in:
Adb command
List of ADB commands.
-
adb devices: shows the list of phones and emulators recognized by the adb server. Useful for finding the TCP/IP port numbers of connected devices. -
adb devices -l: long format version of theadb devicescommand. -
adb install [-l][-r] file_spec: used to install or reinstall an app.- -l : prevents it from being copied over to another device.
- -r: reinstalls the application without deleting existing app data.
- file_spec: the .apk file of the app to install
adb uninstall [-k] package: removes the app with the package name.- -k : keeps the app's data.
- package: the full path of the package, without the .apk extension.
adb push local remote: copies the file named local on the developer's computer to the target system under the name remote.- e.g.
./adb push ~/Project/EduPiano/godot/EduPiano.apk /sdcard/Download/
adb pull remote local: copies the file named remote on the target system to the developer's computer under the name local. adb reboot: reboots the Android system. adb kill-server: stops adb when there is a problem with it. adb start-server: starts adb after it has been stopped. Adb shell commands
ADB Shell is like a minimal Unix shell, so you can explore and modify the target system with simple commands. To connect to the target system's shell and get a # prompt:
Below is a collection of useful shell commands.
-
logcat: view logcat. -
pm: short for package manager. List packages/permissions/instrumentation/features, install/remove packages, etc. -
am: short for activity manager. Start activities, broadcast Intents, start Instrumentation, start / stop profiling, etc. -
service: list Android services, send commands to services. -
monkey: generates random events in an application. Randomly fires user events and system events. -
cat /data/anr/traces.txt: VM TRACES (thread dump). -
cat /proc/binder/proc/[PID]: binder process state. -
cat /proc/binder/xxx: binder-related information (xxx is transaction, transaction_log, failed_transaction_log, stats, etc.). -
cat /data/system/packages.xml: settings information of installed packages. -
setprop: set a system property. -
getprop: print the list of set system properties. -
dumpsys [service]: dump app/service state information; can take additional parameters per service. -
dumpstate: dump device state information. Consists of a combination of several commands that extract state information. -
dumpcrash: dump state information when an application crashes. -
bugreport: logcat + dumpsys + dumpstat.
Screen mirroring
Use it together with scrcpy.