Many Android developers use adb on a daily basis, sometimes even without knowing. In this article, I’m going to explain what adb is, what you can do with it and how it works.
What exactly is adb?
Many Android developers used Android Debug Bridge (or adb as it’s more commonly known) in the following way:
However, it’s not just a terminal utility.
adb is a contract between Android devices and developer tooling
What are the jobs of adb?
The general problem that adb is trying to solve is remote access to compute. To solve this problem adb has to first manage devices, that is:
- Provide CRUD-like API for devices
- Abstract transport layer
- Version the contract between dev tooling and Android devices
Besides managing devices, adb has to provide terminal access to remote devices as well as general-purpose input/output including files, networking and the device’s screen frame buffer.
adb allows us to list available devices, connect new ones and disconnect no longer needed. While adb connects USB devices automatically, we might want to explicitly connect a remote Android device via TCP/IP (or simply pair over WiFi on Android 11+).
Besides listing devices once, we also might need to continually monitor devices and receive notifications on status changes of devices (e.g. connected, disconnected). This simplifies the tooling code a lot since you receive real-time notifications instead of resorting to polling.