Android Debug Bridge (ADB) is a bridge between your computer and Xiaomiโs smartphone that unlocks hidden system functions, unlocks the bootloader, installs custom firmware, removes bloatware, restores bricks after failed experiments, and automates routine tasks, but despite the toolโs power, many users are afraid to touch it โ and in vain.
This article will debunk the myths about ADB complexity and show that itโs easier to work with than it seems. Weโll figure out how to enable USB debugging on Xiaomi (including models on HyperOS), install the necessary drivers, learn how to send basic commands and solve typical problems โ from the error of device unauthorized to the lack of response to adb devices. And youโll learn which three ADB commands can save a smartphone from the soft brick without losing data (spoiler: itโs not just fastboot).
What is ADB and why you need it Xiaomi owners
ADB (Android Debug Bridge) is a console tool from Google built into the Android SDK. It allows you to control your device via the command line, bypassing the limitations of the standard interface. For Xiaomi, this is especially true for three reasons:
- ๐ Unlock bootloader. Without ADB, you can't get permission to install custom firmware (like LineageOS or Pixel Experience).
- ๐งน Remove system applications. MIUI and HyperOS sin with preinstalled software (e.g. Mi Browser, Mi Video) that cannot be removed by standard methods.
- ๐ ๏ธ Recovery from crashes: If a smartphone is stuck on a logo or has gone into a bootloom, ADB is often the only way to bring it back to life.
But ADB is not just useful for advanced users, but it can also be used to:
- ๐ฑ Transfer files to the device at USB 3.0 (faster than MTP).
- ๐ Automate application backup and data backup.
- ๐ฎ Emulate screen taps to test games or automate actions.
โ ๏ธ Warning: ADB provides low-level access to the system. Wrong command can lead to data loss or buildup of the device. Always back up before experimenting!
Preparation: What you need to work with ADB on Xiaomi
Before you start, make sure you have:
| Component | Requirements | Where to find it. |
|---|---|---|
| Computer | Windows 10/11, macOS or Linux. Windows will require administrator rights to install drivers. | โ |
| USB cable | Original cable from Xiaomi (or certified USB-C). Cheap cables may not support data transfer. | Smartphone kit or accessories store |
| Platform Tools | The latest version (at least 34.0.0 for HyperOS) | Official Android website |
| Drivers. | For Windows, Xiaomi USB Drivers or Google USB Drivers. | Xiaomi website |
If you are using Windows, download and install drivers before connecting your smartphone. For the macOS/Linux, no additional drivers are required, but you may need to configure the udev rules (instructions for Linux are given in the spoiler below).
Setting up udev for Linux
After installing Platform Tools, unpack the archive to the root of the C:\ drive (e.g., C:\platform-tools\). This will make it easier to access commands via cmd or PowerShell.
Step 1: Enable USB debugging on Xiaomi
On Xiaomi devices, the path to enabling debugging depends on the firmware version:
- ๐ฑ MIUI 12โ14: Settings โ About Phone โ Version MIUI (click 7 times until the notification โYouโve become a developerโ appears). Then go back to Settings โ Additional โ For Developers โ Debugging on USB.
- ๐ HyperOS: Settings โ About Phone โ HyperOS Version (also 7 taps). Next: Settings โ Additional โ Developer Settings โ Debugging on USB.
Once activated, connect your smartphone to your computer and select the data transfer mode (Files or MTP). On the device screen, a request for debugging permission will appear - be sure to tick "Always Allow from this computer" and click Allow.
โ ๏ธ Warning: If the debugging request doesn't appear, check: Is the original cable connected (cheap cables often don't transmit data for debugging) is the driver installed (Device Manager shouldn't have exclamation points near Xiaomi) is the developer mode activated (sometimes reboot is required).
โ๏ธ Checking before connection ADB
Step 2: Check the connection and basic commands
Open the command line (cmd or PowerShell) and go to the folder with Platform Tools:
cd C:\platform-tools\Run a command to check connected devices:
adb devicesIf everything is configured correctly, you will see your Xiaomi serial number with device status. If it displays unauthorized instead, it means:
- ๐ You have not confirmed the debugging request on your smartphone (reconnect the device).
- ๐ The RSA- key has changed on the computer (remove the adbkey.pub file in the.android folder in the user's home directory).
Now you can try simple commands:
| Team team. | Description | Example of inference |
|---|---|---|
| adb shell | Opens the shell of the device (analogue of the terminal on the smartphone). | redmi:/ $ |
| adb pull /sdcard/DCIM/photo.jpg C:\Images\ | Copies photo.jpg file from device to computer. | [100%] /sdcard/DCIM/photo.jpg: 1 file pulled, 0 skipped. |
| adb install app.apk | Installs the APK- file on the device. | Performing Streamed InstallSuccess |
๐ก
To avoid./adb or./fastboot every time, add the platform-tools folder to the PATH environment variable. Instructions for Windows: here.
ADBโs Useful Teams for Xiaomi: From Unlocking to Recovery
Now, let's get to the practice. Below are the teams that Xiaomi owners will use 90 percent of the time.
1. Unlocking the bootloader (bootloader)
To install custom firmware or obtain root rights, you first need to unlock the bootloader. This is an official procedure, but requires an account binding Mi:
adb reboot bootloader
fastboot oem unlockOnce completed, the smartphone will restart and erase all data! Read more about unlocking in FAQ.
2. Removal of system applications (without root)
To remove unnecessary software (such as Mi Browser or Mi Music), first look for the name of the package:
adb shell pm list packages | grep "miui"Then remove it (replace com.miui.browser with the desired package):
adb shell pm uninstall -k --user 0 com.miui.browserThe --user 0 flag removes the application only for the current user, without affecting the system.
adb shell cmd package install-existing com.miui.browser3. reset of the pattern lock (if you forgot the password)
If you forgot the pattern lock or PIN- code, but debugging on USB was enabled before blocking, you can reset it without losing data:
adb shell rm /data/system/gesture.key
adb shell rm /data/system/locksettings.db
adb shell rm /data/system/locksettings.db-wal
adb shell rm /data/system/locksettings.db-shm
adb rebootAfter the reboot, the lock screen will disappear.Warning: on newer versions of MIUI/HyperOS, this method may not work due to enhanced protection.
4.Recovery from "soft brick"
If the smartphone is getting stuck on the Xiaomi logo or went into a bootloom, try:
adb reboot recoveryIf recovery is not available, go to fastboot and flash the stock firmware:
fastboot flash boot boot.img
fastboot flash system system.img
fastboot reboot1. adb reboot recovery โ transition to recovery for reset.
2. fastboot flash boot.img โ recovery of the boot partition.
3. fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img Disabling signature verification (relevant for Android) 10+).-->
Solving Typical ADB Problems on Xiaomi
Even with the right setup, ADB can be unstable, and here are the most common errors and solutions.
| Mistake. | Reason. | Decision |
|---|---|---|
| device unauthorized | No debugging request has been confirmed or the RSA- key has been reset. | Remove adbkey.pub (see above) and reconnect the device. |
| no devices/emulators found | Drivers are not installed or the cable is faulty. | Check Device Manager for errors. Try another USB cable/port. |
| adb: command not found | The platform-tool folder is not added to PATH. | Use the full path (e.g., C:\platform-tools\adb devices) or configure environment variables. |
| cannot stat 'file': No such file or directory | The wrong path to the file (for example, when adb push). | Check the file location or use the full path (e.g. adb push C:\app.apk /sdcard/). |
If Xiaomi is not defined in fastboot (the fastboot team doesnโt show anything), try:
- Switch to another USB-port (preferably USB 2.0).
- Press the button Volume down + Power for 10 seconds to force the transition to fastboot.
- Install drivers manually through Device Manager (select Android Bootloader Interface).
โ ๏ธ Warning: Some Xiaomi models (e.g. Redmi Note 12 or Xiaomi 13) require an unlocked bootloader to work with fastboot. If the device does not respond to commands, check lock status via fastboot oem device-info.
ADB over Wi-Fi: How to manage Xiaomi without cable
If you're tired of connecting your smartphone over USB, you can configure ADB over Wi-Fi.
- Connect the device via USB and do:
- Turn off the cable and find the IP- address of the smartphone in the Wi-Fi settings (e.g., 192.168.1.100).
- Connect to Wi-Fi:
Now all ADB commands will run wirelessly! To return the USB- mode, run:
adb usbPlease note:
- ๐ The device and computer must be on the same Wi-Fi network.
- ๐ After the smartphone is restarted, you will need to re-run adb tcpip 5555.
- โก The data rate over Wi-Fi is lower than over USB 3.0.
alias adbconnect='adb connect 192.168.1.100:5555'
Now it is enough to enter adbconnect in the terminal.-->