Modern smartphone users often face the limitations of the standard interface when it is necessary to fine-tune the system or access hidden functions of the device. A tool that opens the door to deep settings Androidis ADB (Android Debug Bridge). This is a universal command line utility that allows the computer to interact with the phone or emulator at the highest level of rights.

Use adb does not require obtaining root access, which makes this method safe for most devices and avoids voiding the warranty. Using this bridge, you can install applications, remove system software, make full backups of data, and even reflash the device in Recoverymode. In this article, we will look in detail at how to set up the environment and which commands are most useful for day-to-day management of the gadget.

Before you start, make sure that you have a USB cable that supports data transfer, not just charging, and a computer running Windows, macOS or Linux. The setup process may seem complicated to a beginner, but it opens up enormous opportunities for customizing and resuscitating your smartphone in case of software failures.

Preparing the working environment and enabling debugging

The first step towards use Android Debug Bridge is to activate a special mode on the smartphone itself. By default, this function is hidden from the eyes of the average user for system security reasons. You need to go to the menu Settings and find the item About phone (or About device). Here you need to find the line Build number and quickly click on it 7 times in a row.

After a series of clicks the system will issue a notification that you have become a developer. Now a new section will appear in the main settings menu For developers. Go into it and activate the switch USB debugging. When you connect the cable to the computer, a request will appear on the smartphone screen to confirm the authorization of this PC - be sure to press Allow, otherwise the commands will not be executed.

โš ๏ธ Warning: Never enable USB debugging when connecting to public charging stations or other people's computers. This could give attackers access to your data or the ability to install malware without your knowledge.

Next, you need to install the tools themselves on your computer. Previously, they were distributed as part of a huge package Android SDK, but now Google provides a minimalistic set Platform Tools. Download the archive from the official website of the developers and unpack it into a convenient folder, for example C:\platform-tools. For ease of use, it is recommended to add the path to this folder to the system environment variables PATHto run commands from any terminal directory.

โ˜‘๏ธ Ready to work with ADB

Done: 0 / 4

Basic commands for checking connection and control

After installing the drivers and configuring the phone, itโ€™s time to check the connection between the devices. Open a command prompt or terminal in the utility folder and enter the first diagnostic command. If everything is configured correctly, you will see your device's serial number and status device.

adb devices

This command is the foundation for all subsequent operations. If unauthorizedis displayed instead of the device number, check your smartphone screen - you may have missed the pop-up window asking for trust. If the device does not appear in the list at all, the problem may lie in the USB drivers or a faulty cable.

Simple instructions are used to reboot the device into various modes. For example, the command adb reboot will perform a normal reboot, and adb reboot bootloader will put the phone into the mode Fastbootnecessary for unlocking the bootloader or flashing partitions. There is also a command to enter recovery mode Recoverywhich is often required to reset settings or install updates.

๐Ÿ’ก

If the adb devices command does not see the phone, try changing the USB port on the motherboard (it is better to use the ports on the back of the system unit) or replacing the cable with the original one.

Screen power management is also available through the console. You can forcefully turn off the display with the command adb shell input keyevent 26 or wake up the device with the same sequence. This is useful when automating tests or when the touch screen partially does not work.

Installing and uninstalling applications via the console

One โ€‹โ€‹of the most popular functions ADB is managing installed packages. You can install APKfiles directly from your computer without first copying them to your phone. For this, the flag -ris used, which allows you to reinstall the application while preserving user data, which is critical when updating modified versions of apps.

adb install -r path_to_file.apk

The reverse operation - deleting apps - requires special care. First you need to know the exact package name of the application, which is often different from its display name. Use the command adb shell pm list packages to list all installed packages. You can filter the search by name by adding a keyword, for example, adb shell pm list packages facebook.

To remove a system application that cannot be erased through standard settings, use the command uninstall with the flag -k (saving cache and data) or without it. It is important to understand that deleting critical system components can lead to bootloop (cyclic reboot).

Command Description of action Requires root access
adb install app.apk Installing the application No
adb uninstall com.package Complete removal of the package No
adb shell pm disable-user Disabling the application for the current user No
adb shell pm clear com.package Clearing application data and cache No
How to return a deleted system application?

If you deleted a system application via ADB without root access, it is not physically erased, but only hidden for the current user. To get it back, use the command: adb shell pm install-existing com.package.name

Working with the file system and transferring data

Moving files between a computer and a smartphone via adb is often faster and more reliable than using the MTP protocol, which can break down when transferring large amounts of data. The command push copies a file from the computer to the device, and pull downloads the file from the phone to the PC.

The command syntax is intuitive: first the action is specified, then the path to the source and the path to the destination. If the destination path is not specified, the file is saved in the current terminal directory. This is especially convenient for retrieving application databases or configuration files that are not accessible in a regular file manager.

adb push C:\file.txt /sdcard/Download/

adb pull /sdcard/DCIM/Camera/ D:\Backup\Photos

The shell is used to view the contents of directories on the device. shell. Standard Linux commands work inside it: ls to list files, cd to change directory, rm to delete. However, remember that without root access you will not be able to write data to system partitions such as /system or /data (with the exception of some subfolders).

๐Ÿ’ก

Using ADB to transfer files bypasses the limitations of MTP drivers and allows you to work with files even if the phone screen is broken and the sensor is not responding.

Receiving logs and diagnosing the system

When an application crashes or the system behaves unstable, developers use logs to find the cause of the failure. The utility logcat displays the system event log in real time. Android. This data stream can be huge, so it is usually filtered by application tag or message severity level.

To save the log to a file for later analysis, use output redirection. This allows you to record the moment the error occurred. The command works until you interrupt its key combination Ctrl+C. Log analysis requires knowledge of message structure Android, but even a beginner can find lines marked FATAL or CRASH.

adb logcat -d > crash_log.txt

Command bugreport, which creates a complete dump of the device state, including logs, core dumps and configuration information. This report takes a few minutes to generate, but is a comprehensive source of information for support or help forums.

โš ๏ธ Warning: The bugreport file may contain sensitive information, including call history, messages, and account data. Do not transfer this file to third parties without first clearing sensitive data.

๐Ÿ“Š For what purpose do you most often use ADB?
Removing unnecessary software
Installing applications
Removing error logs
Unlocking the bootloader
Other

Advanced scripts and security

For users who want to automate processes, ADB offers the ability to run scripts. You can create a bat file on Windows or a shell script on Linux that will sequentially execute a set of commands: clear the cache, disable unnecessary services and reboot the phone. This saves time when configuring devices in bulk.

Particular attention should be paid to the command adb root. It tries to restart the debugging daemon as root. On most custom ROMs, this command will not work and will produce an error because root access is blocked. However, on engineering versions of the software or custom firmware, this gives complete control over the file system.

Connection security is ensured through RSA keys. When you first connect, your computer and phone exchange cryptographic signatures. If you want to revoke access for all previously connected PCs, go to the developer settings and click Cancel debugging permission. This will reset the keys and require confirmation again the next time you connect.

Interfaces and capabilities may vary slightly depending on the version Android and the manufacturer's shell (MIUI, OneUI, ColorOS). Always check the current commands with the official Google documentation or the 4PDA/XDA forum if standard methods do not work on your specific model.

Frequently asked questions (FAQ)

Is it safe to delete system applications via ADB?

Uninstallation via pm uninstall --user 0 is secure in the sense that it does not physically erase files, but only hides them for the current user. You can always restore the application with the command install-existing. However, deleting critical components (for example, the system launcher or Google services) may result in the phone not working.

The computer does not see the phone in ADB mode, what should I do?

Check the USB drivers in Device Manager. Try a different cable. Make sure the phone screen confirms the debugging request. Sometimes restarting the daemon with the commands adb kill-server and adb start-server.

Is it possible to use ADB without enabling USB debugging?

No, the standard ADB protocol requires explicitly enabling debugging. The exception is devices with an unlocked bootloader, which can accept some commands in Fastboot mode, but the functionality there is significantly limited compared to a running system.

How to find the name of the application package to uninstall?

Use the command adb shell pm list packages | grep "name_part" (on Linux/Mac) or adb shell pm list packages | findstr "part_of_name" (on Windows). There are also assistant applications in the Play Market that show the name of the installed software package.

Does ADB work over Wi-Fi?

Yes, starting with Android 11, you can connect via Wi-Fi directly through the developer settings. On older versions, you must first connect the phone via cable and enter the command adb tcpip 5555, then disconnect the cable and connect via IP address: adb connect IP_address:5555.