The world of mobile development and deep customization of Android often seems like a closed club for the elite, but in fact the keys to it lie on the surface. The abbreviation ADB (Android Debug Bridge) scares many users with its name containing the word โ€œDebugโ€ (debugging), but it is a powerful tool available to every smartphone owner. Imagine getting remote access to the internals of your operating system, the ability to manage files, install applications, and even restore your device when the screen becomes unresponsive.

At its core, Android Debug Bridge is a universal command line tool that allows your computer to communicate with your Android device. It is part of the package Android SDK Platform-Tools and serves as a bridge between your PC and your phone. ADB makes it easier to perform various device actions, such as installing and debugging applications, and provides access to the Unix shell, which you can use to run a variety of commands on your device.

Why should the average user know about ADB? The answer is simple: this tool opens the door to features hidden by front-end developers. You can remove unused system applications (bloatware), make a full backup of your data, flash a custom recovery, or simply copy files when USB debugging is the only way to communicate with your phone. Understanding how it works turns you from a passive consumer of content into an active user who can optimize the operation of your gadget to suit your own needs. Android Debug Bridge, turns you from a passive consumer of content into an active user who can optimize the operation of your gadget to suit your own needs.

The architecture and principle of operation of Android Debug Bridge

To use it effectively ADB, you need to understand what components it consists of. This is not one app, but a client-server app that includes three components: a client, a daemon and a server. The client sends commands; the client runs on the computer from which you enter the commands adb. The daemon, called adbdexecutes commands on the device; The daemon runs as a background process on each device.

The server manages the communication between the client and the daemon. It runs as a background process on your computer. When you run the command adb, the client first checks to see if the server process is running. If not, it runs it. Then the server establishes a connection with all running emulators and devices Android. It is this architecture that allows you to execute commands asynchronously and control several devices simultaneously.

โš ๏ธ Attention: When working with ADB you receive privileged access to the system. Improper execution of commands, especially those related to deleting system partitions or changing permissions, can cause the device to stop booting (bootloop). Always check the command in a search engine before entering it.

Communication between components can be carried out via a USB cable or over a Wi-Fi network (TCP/IP). A local USB connection is the most stable and secure option for initial setup. Wireless connection is convenient for developers who need to frequently reconnect the device without pulling the cable, but it requires preliminary configuration via USB and the devices being on the same network.

๐Ÿ’ก

The ADB server acts as an intermediary, ensuring stable data transfer between the console of your computer and the debugging process on your smartphone.

Preparing the environment: installing drivers and Platform Tools

Before you can enter your first command, you need to prepare the software environment on your computer. To work with ADB you will need a package Android SDK Platform-Tools. This is the official set of tools from Google, which is regularly updated and contains the latest versions of the binary files adb and fastboot. It should be downloaded exclusively from the official Android developer website to avoid malware.

In addition to the tool itself, device drivers are critically important. If you are using Windows, the system may not recognize your smartphone in debug mode without specific drivers. For devices of popular brands, such as Samsung, Xiaomi or Google Pixel, drivers are often installed automatically when connected via Google USB Driver, but in some cases manual installation of proprietary software is required (for example, Samsung USB Driver).

  • ๐Ÿ“ฅ Download the archive Platform-Tools from the official Google resource for your OS (Windows, Mac or Linux).
  • ๐Ÿ’ป Unpack the archive into a convenient folder, preferably at the root of the disk (for example, C:\platform-tools) so that the path does not contain spaces and Cyrillic characters.
  • ๐Ÿ”Œ Install universal Google USB drivers via Android Studio or proprietary utilities manufacturer of your smartphone.
  • ๐Ÿ”ง Add the path to the tools folder to the system environment variables (PATH) to run adb from any command line directory.

After installation, it is recommended to open the command line (Terminal or CMD) and enter a simple command adb versionIf the system displays. version number and revision information, it means the installation was successful. If you see an error message "command not found" or "is not an internal command", it means that the path to the executable file is not specified in the environment variables, and you need to do this manually through the system settings.

๐Ÿ’ก

For Windows users, the most convenient way to work with ADB is to open the command line directly in the tools folder: hold Shift, right-click on empty space in the folder and select "Open a PowerShell window here" or "Open in terminal."

Activating USB debugging mode on the device

The most important setup step is enabling the developer mode on the smartphone itself. By default, this function is hidden to prevent inexperienced users from accidentally changing the settings. To unlock the menu, you need to go to. section Settings and find the item About phone (or About device). Inside this section you need to find the line Build number.

Click on Build number quickly 7 times in a row. The system will start counting down the presses, telling you how much time is left until developer mode is activated. After the seventh press, a notification will appear indicating that you have become a developer, and a new section will appear in the main settings menu - For developers (or Developer Options). Inside this menu you need to find the switch USB debugging and activate it.

โš ๏ธ Attention: When you first connect a device with debugging enabled to a new computer, a dialog box will appear on the smartphone screen asking you to allow debugging. Be sure to check the box "Always allow from this computer" and click "OK", otherwise the commands ADB will not be executed.

In some modern shells, such as As MIUI from Xiaomi or ColorOS from Oppo, the process may be complicated by security requirements. You may need to log into your manufacturer's account and wait 7 days (168 hours) after enabling debugging before you can use advanced commands such as unlocking the bootloader or deep boot. modification of the system. This is done to protect user data in case the device is stolen.

โ˜‘๏ธ Checking the ADB connection

Done: 0 / 5

Basic control commands and device diagnostics

When the device is connected and recognized, the most interesting part begins. The command adb devices is. The first one you must enter. It displays a list of all connected devices with their serial numbers and status. Status device indicates a successful connection, while unauthorized indicates that you have not confirmed the resolution on the phone screen, and offline indicates problems with the connection or drivers.

There is a command adb installto install applications. It allows you to install an APK file from your computer to your smartphone without having to transfer the file to the internal memory and run it manually. The syntax is simple: adb install path/to/app.apk. If the application is already installed, but you want to update its saved data, add the flag -r: adb install -r app.apk. those who install modified versions of apps.

The file system is managed through the commands adb push and adb pull. The first copies the file from the computer to the phone (adb push file.txt /sdcard/), and the second downloads the file from the phone to the computer (adb pull /sdcard/DCIM/Camera/photo.jpg.). at the end of the second command indicates the current directory on the computer where the file will be saved. These commands are faster and more reliable than standard copying through MTP Explorer.

Command Description of action Usage example
adb reboot Reboots the device into normal mode adb reboot
adb reboot bootloader Reboots the device into bootloader mode (Fastboot) adb reboot bootloader
adb shell Opens a Linux command shell directly on the phone adb shell
adb logcat Outputs system logs in real time (for debugging) adb logcat | findstr "Error"
adb kill-server Stops the ADB server (useful when freezing) adb kill-server
What is ADB Shell?

The adb shell command opens an interactive Linux session on your Android. Inside it, you can execute commands as if you were sitting at the terminal of the phone itself. This allows you to view processes, manage rights and run scripts.

Advanced scenarios: removing system software and scripts

One โ€‹โ€‹of the most popular features ADB is the removal of pre-installed applications that cannot be removed through the standard interface. To do this, use the package manager pm inside the shell adb shell. The command pm uninstall -k --user 0 deletes the application for the current user without affecting the system partition. This is safe because when you reset the settings, the application will return, but for now it will not take up space and consume resources.

To find out the package name of the application that you want to remove, you can use the command adb shell pm list packages with a filter. For example, adb shell pm list packages | findstr "facebook" will show all packages related to Facebook. Knowing the exact package name (for example com.facebook.katana), you can safely deactivate it. This is a great way to clean your smartphone of โ€œgarbageโ€ that is imposed by manufacturers and telecom operators.

Also ADB allows you to make complete backups of application data, including their settings and cache, using the command adb backup. The syntax looks like this: adb backup -apk -all -f backup.ab. The flag -apk saves the application installation file itself, and -all indicates the backup of all installed apps. However, it is worth noting that in the latest versions of Android, many applications prohibit the creation of backup copies of their data through this mechanism for security reasons.

โš ๏ธ Warning: The command pm uninstall without a flag --user 0 may attempt to remove the application from the system completely, which will require superuser rights (Root) and may lead to system failure. Use only safe syntax for the current user.

๐Ÿ“Š What problem would you solve using ADB first?
Removing adware
Screenshots and screen recording
Installing applications
Error diagnosis
I donโ€™t know yet

Wireless connection and debugging via network

Although the cable remains the most reliable method of communication, ADB supports work via a Wi-Fi network, which is especially convenient during development or when the charging connector is busy another device. To activate this mode, you first need to connect your phone via USB and execute the command adb tcpip 5555. This switches the debug daemon to listen on TCP port 5555.

The cable can then be disconnected. Find out the IP address of your smartphone in the Wi-Fi settings (usually it looks like 192.168.1.XX) and enter the command adb connect 192.168.1.XX:5555. If everything is configured correctly, the device will appear in the list of connected ones with status device. Now you can control your phone from anywhere in the room where your Wi-Fi network is active.

0, and the connection may be less stable. To transfer large amounts of data or update device firmware, it is highly recommended to use a cable. Wireless mode is ideal for entering commands, taking logs, or sharing the screen, but not for heavy I/O operations.

๐Ÿ’ก

Wireless debugging requires that the computer and smartphone be on the same Wi-Fi subnet; in public networks with client isolation, this function will not work.

Frequent problems and methods for solving them

Despite its versatility, users often encounter a problem when the command adb devices shows the device in status unauthorized. This means that a confirmation window appeared on the phone screen, but the user missed it or clicked โ€œCancel.โ€ The solution is simple: disconnect and reconnect the cable, carefully watching the smartphone screen, and confirm the RSA key fingerprint.

Another common situation is that the device does not appear in the list at all. In 90% of cases, the problem lies in Windows drivers or a faulty USB cable. Many cables only support charging and do not transfer data. Try replacing the cable with an original one or a known good one, and also switching the USB port on the computer (it is advisable to use USB 2.0 ports, as they are sometimes more stable for debugging than 3.0).

If the server is frozen and does not see changes in device connections, restarting the service will help. Execute the commands ADB stuck and does not see changes in device connections, restarting the service will help. Execute the commands sequentially adb kill-server and adb start-serversequentially. This will clear the connection cache and force the server to rescan available ports. In rare cases, completely restarting the computer and smartphone helps.

Is it safe to delete system applications via ADB?

Yes, if you use the command pm uninstall -k --user 0. This removes the application for your user only, without affecting the system partition. A factory reset will return the app. However, you cannot delete critical system components (for example com.android.phone) - this will lead to the device not working.

Can I use ADB without a computer?

Standard ADB requires a client computer. However, there are applications for Android (for example, Termux) that allow you to run a local ADB server and execute some commands directly on the device, but for a full bridge between PC and phone, a computer is required.

Why does ADB not see a Xiaomi or Huawei device?

On devices of these brands, additional confirmation is often required. In the "For Developers" menu there may be an item "USB Debugging (Security Settings)" that needs to be enabled. Also on Xiaomi you need to insert a SIM card and log into your Mi account to activate advanced debugging features.

How to disable USB debugging?

Simply go to Settings -> For Developers and turn off the switch USB Debugging. This will immediately break the connection to the computer and close the port to external commands, increasing the security of the device.

Does ADB work on a broken screen?

If the sensor does not work, but there is an image, and debugging was enabled in advance, you can control the phone using commands adb shell input tap x y (click emulation) or connect a USB mouse via OTG. If the screen is black and debugging is turned off, ADB will not help.