Android Debug Bridge (ADB) is a powerful tool for interacting with the Android operating system that allows you to access hidden features of Xiaomi, Redmi and POCO smartphones. It can install custom firmware, remove system applications, unlock the bootloader, and diagnose malfunctions that are not available through the standard interface. However, improper use of ADB can lead to a locking of the device or loss of warranty if you violate the rules of operation with MIUI.
In this guide, we will discuss how to set up ADB on Xiaomi from scratch: from enabling debugging over USB to executing basic and advanced commands. This article is relevant for all models based on MIUI 12/13/14 and HyperOS, including Xiaomi 13/14, Redmi Note 12/13, POCO F5/X5 and older devices.
What is ADB and why is it needed for Xiaomi?
ADB (Android Debug Bridge) is a console tool from the Android SDK package that lets you control your device via the command line. On Xiaomi smartphones, it is used to:
- π§ Install custom firmware (such as LineageOS or Pixel Experience) via fastboot or sideload.
- ποΈ Remove embedded applications (bloatwers) such as com.miui.analytics or com.xiaomi.midrop.
- π Unlock the bootloader to obtain root rights or install TWRP.
- π± Transfer data between devices without cloud services (for example, via adb) pull/push).
- π Diagnostics of system errors when the smartphone is not turned on or is unstable.
It is important to understand that Xiaomi limits some of the ADB features in standard MIUI firmware. For example, without unlocking the bootloader, you can not get full access to system partitions. However, even basic commands (for example, adb shell pm list packages) will help optimize the operation of the device.
β οΈ Attention: Use ADB On devices with a locked bootloader, it can cause a factory reset. Always back up the data before experimenting!
Preparation: What you need to work with ADB on Xiaomi
Before you connect to your smartphone via ADB, make sure you have:
- π± Smartphone Xiaomi/Redmi/POCO Android version 8.0 or newer (some teams may not work on older versions).
- π» Computer running Windows 10/11, macOS or Linux (instructions for all OSes are below).
- π Cable USB (It is preferable to be original, as cheap cables may not support data transmission).
- π οΈ Utilities. ADB Fastboot (can be downloaded separately or via Android Studio).
Windows will also require Xiaomi drivers that are automatically installed via Mi PC Suite or manually from the official website. On macOS/Linux, drivers are not needed, but you may need to configure device access rights through udev.
| Component | Windows | macOS/Linux |
|---|---|---|
| Download ADB | 15 Seconds or the Official Package of ADB Installer | Brew install android-platform-tools (macOS) or sudo apt install adb (Linux) |
| Drivers. | Mi PC Suite or manual installation via Device Manager | Not required (libusb used) |
| Connection check | Adb devices in CMD | ./adb devices in Terminal |
How to enable debugging by USB on Xiaomi
By default, the USB debugging option is hidden in the MIUI settings to activate it:
- Go to Settings. β The phone.
- Click 7 times on MIUI until you become a developer!
- Return to the main settings menu and open Additional β for developers.
- Activate the switches: π§ Debugging by USB π Allow unlocking OEM (necessary to unlock the loader) π Disable the check MIUI (Optionally, for the installation of unofficial firmware)
Once you turn on debugging, connect your smartphone to your computer, and you'll see a request for debugging permission on your screen -- confirm it by ticking Always Allow from that computer, and if you don't, you'll have to confirm access again every time you connect.
β οΈ Note: Some Xiaomi models (e.g. Redmi Note 10 Pro) POCO X3 Pro) option Allow unlocking OEM It can disappear after rebooting, and then it needs to be turned on again before each unlock.
USB| debugging enabled
Drivers installed (for Windows)|
Smartphone connected with original cable |
Allowed access to the device on the screen Xiaomi-->
Installation of ADB on a computer: step-by-step instructions
The installation process depends on the operating system, and the instructions for Windows, macOS and Linux are below.
For Windows.
1. Download Platform Tools from the official Android Developers website and unpack the archive to the root of the C:\ drive (e.g., C:\platform-tools).
2. Open the Command Prompt (Win + R β cmd) and go to the folder with ADB:
cd C:\platform-tools3. Check the connection of the device:
adb devicesIf the smartphone appears in the list (for example, 1234abcd device), the installation was successful.
For macOS
1. Install Homebrew (if not installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"2. Install ADB:
brew install android-platform-tools3. Connect the smartphone and check its availability:
adb devicesFor Linux (Ubuntu/Debian)
1. Update packages and install ADB:
sudo apt update && sudo apt install adb fastboot2. Add the user to the plugdev group:
sudo usermod -aG plugdev $LOGNAME3. Create a rule for udev (if the device is not defined):
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="2717", MODE="0666", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/51-android.rules4.Reboot the udev service:
sudo udevadm control --reload-rulesπ‘
If you see unauthorized status after you're connected, reconnect the cable and confirm access on your smartphone screen, sometimes rebooting the device helps.
The main ADB teams for Xiaomi: what can be done
Once connected successfully, you can execute commands to control the device, and the following are the most useful ones for Xiaomi owners.
| Team team. | Description | Example |
|---|---|---|
| adb devices | Shows connected devices | List of devices attached1234abcd device |
| adb shell | Opens the Android shell to execute commands inside the system | adb shell ls /system/app |
| adb install | Set up APK-file | adb install app.apk |
| adb pull | Copying a file from device to computer | adb pull /sdcard/DCIM/photo.jpg |
| adb reboot bootloader | Reboots the device to fastboot mode | It is necessary to unlock the loader |
To remove system applications (such as Mi Browser or Mi Video) use:
adb shell pm uninstall -k --user 0 com.android.browserPlease note that removing some applications may cause MIUI to work unstable, and it is recommended to back up before doing so:
adb backup -apk -obb -shared -all -f backup.abList of safe to remove MIUI packets
Unlock bootloader on Xiaomi via ADB
To install custom firmware or obtain root rights, you need to unlock the bootloader. Xiaomi officially allows this, but the process requires confirmation through your Mi Account.
Steps to unlock:
- Link the device to your Mi Account in Settings β Xiaomi Account.
- Go to the official unlock site and download the Mi Unlock Tool utility.
- Run the utility on your computer and log in under the same Mi Account.
- Switch to fastboot: Adb reboot bootloader
- Connect the device to your computer and press Unlock in the program. It takes 3-5 minutes.
Once unlocked, all data on the device will be erased! Xiaomi also introduces a restriction: re-unblock is possible only after 30 days (on some models β 7 days).
β οΈ Note: On devices with MediaTek processors (e.g. Redmi Note) 11 or POCO M4 Pro) unlocking the loader may result in loss IMEI. Before the procedure, save it through the command adb shell su -c 'cat /data/nvram/md/NVRAM/NVD_IMEI/IMEI'.
π‘
Unlocking the bootloader will void the Xiaomi warranty, but it can be restored by returning the device to factory status via the Mi Flash Tool.
Typical Xiaomi ADB Mistakes and How to Fix Them
When working with ADB, users often encounter errors, and here are the most common ways to fix them:
- π« device unauthorized - the device did not confirm trust in the computer. Solution: Disconnect / connect the cable and confirm access on the screen of the smartphone.
- π no devices found - drivers not installed or cable faulty Solution: Check the connection via another port USB Or install the drivers manually.
- π Wait for device β the device does not respond. Solution: Reboot your smartphone and computer, then repeat the command.
- π adb: error: failed to get feature set: no devices/emulators found ADB Solution: Perform adb kill-server, then adb start-server.
If after unlocking the bootloader the device hung on the MI logo, try reflashing it through fastboot:
fastboot flash boot boot.img
fastboot flash system system.img
fastboot rebootTo restore IMEI on MediaTek devices, use the SN Write Tool or Maui META (requires a separate instruction).