adb: the full story

Anton Malinskiy
15 min readNov 4, 2021

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.

Photo by Modestas Urbonas on Unsplash

This article is based on my recent talk How to work with adb
at Podlodka Droidcrew. Feel free to check out the talk if you prefer to listen and know Russian.

What exactly is adb?

Many Android developers used Android Debug Bridge (or adb as it’s more commonly known) in the following way:

Simple adb cli demo

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.

Managing devices

CRUD-like API

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+).

adb connect/disconnect demo

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.

Abstract transport…

--

--

Anton Malinskiy

Software engineer & IT conference speaker; Landscape photographer + occasional portraits; Music teacher: piano guitar violin; Bike traveller, gymkhana