Xiaomi’s Complete Setup Guide for Developers: From Unlocking to ADB

Xiaomi MIUI-based smartphones are a popular choice among developers thanks to a combination of affordable prices, powerful hardware and flexible customization capabilities. However, to unlock the full potential of the device, it is not enough to just buy a Redmi Note 12 Pro+ or POCO F5 – you need to properly customize the system for development tasks: unlock the bootloader, activate debugging over USB, get root access (if necessary), and avoid the typical errors that can turn the phone into a β€œbrick”.

This article is not about superficial tips like β€œturn on Developer Mode.” Here you will find detailed instructions with the features of MIUI 14/15, the nuances of working with the Mi Unlock Tool, circumventing restrictions on new models (for example, Xiaomi 14 Ultra), and ways to recover from failed manipulations. We will analyze both official methods and workarounds for devices with a locked bootloader, and also explain why unlocking on models from 2023-2026 requires a Mi Account binding and how to do this without waiting for 168 hours.

1. Activation of the developer mode on Xiaomi

The first step is to include a hidden menu for developers. In MIUI, this process is standard, but there are nuances for different versions of firmware:

On devices with MIUI 14/15 (including HyperOS for new models), the path is as follows:

  1. Open the Settings. β†’ The phone.
  2. Find the MIUI version and tap it 7 times in a row (some models may require a pattern lock).
  3. After the notification β€œYou became a developer!” appears, return to the main settings menu – there will be a new section Additional β†’ For developers.

⚠️ Warning: On POCO and some global versions of Redmi, the item may be called Build number instead of β€œVersion MIUI.” Also on HyperOS devices (e.g. Xiaomi 14), the developer menu may be hidden deeper β€” check Settings β†’ Memory β†’ Additional.

After activation, it is recommended to immediately activate:

  • πŸ”§ Debugging according to USB (Settings β†’ For developers β†’ Debugging according to USB) is mandatory for working with ADB.
  • πŸ”„ Unlock OEM (Unlock OEM) – Needed to unlock the bootloader (may be absent on some models).
  • πŸ“± Do not turn off the screen while charging (Stay on) is convenient for long debugging sessions.

πŸ’‘

If the OEM Unlock is not available, it means that the bootloader is already unlocked or the device does not support official unlocking (for example, some regional versions of Redmi for China).

2 Unlock the bootloader: the official method

Unlocking the bootloader on Xiaomi is a must for custom firmware installation, root rights or device recovery after soft-brick. The official method requires the use of the Mi Unlock Tool utility, but since 2023 Xiaomi has tightened the rules:

Requirements for unlocking:

  • πŸ“± Device based on MIUI (non-custom firmware).
  • πŸ”‘ Related Mi Account (required to have a confirmed phone number!)
  • ⏳ Wait 168 hours (7 days) after linking your account to your device.
  • πŸ’» Windows computer (official utility does not work on macOS/Linux).

Step-by-step:

  1. Download Mi Unlock Tool from the official website.
  2. Turn on USB debugging and connect your phone to your PC.
  3. Launch the utility, log in under the same Mi Account as on your phone.
  4. If you see a "Couldn't unlock" error, check if 168 hours have passed since your account was linked.

⚠️ Warning: On newer models (Xiaomi 13T, Redmi Note 13 Pro+ and later), unlocking may require additional confirmation via SMS or even video identification.

What if the Mi Unlock Tool can’t see the device?
1. Make sure you have Mi USB Driver installed (you can download it on the official website). 2. Try using another USB- cable (preferably original). 3. Include the USB- configuration β†’ File Transfer (MTP) in the developer settings. 4. If the utility gives an error 0x80004005, try running it on behalf of the administrator or using the utility version for MIUI 14 (not the most recent!).

3. circumvention of restrictions: unlock without waiting 168 hours

The official wait of 7 days is a major headache for developers, and fortunately there are ways to get around this limitation, but they require caution:

Method 1: Use the old version of the Mi Unlock Tool

Some versions of the utility (for example, 5.5.224.24) allow you to unlock the bootloader without waiting.

  1. Download the archive with a utility (for example, with XDA Developers).
  2. Turn off the Internet on your PC before launching the Mi Unlock Tool.
  3. Connect your phone in Fastboot mode (clip Volume Down + Power when the device is off).
  4. Start the utility and follow the instructions. If you have a wait error, try again after 24 hours (sometimes it helps).

Method 2: Resetting waiting times through ADB

This method does not work on all models, but it can reset the timer:

adb shell


su




setprop persist.sys.miui_boot_unlock 1




reboot

After the reboot, try to run the Mi Unlock Tool again.

πŸ“Š What Unlocking Method You Used?
Official (168 hours)
The Mi Unlock Tool is an old version of the Mi Unlock Tool.
ADB-team
Another way.

4.Setting up ADB and Fastboot: The main commands

Once unlocked, you can start working with ADB (Android Debug Bridge) and Fastboot, which allow you to control the device from a PC, install firmware and modifications.

Install ADB/Fastboot on PC:

  • πŸ–₯️ For Windows: download Google’s Platform Tools and unpack it to the root of the drive C:\.
  • 🐧 For Linux/macOS: Install packages via terminal: sudo apt install adb fastboot # Debian/Ubuntu brew install android-platform-tools # macOS

ADB Basic Teams:

Team team.Description
adb devicesShows connected devices (serial number should be displayed).
adb shellOpens the shell of the device to execute commands.
adb push file.txt /sdcard/Copies a file from the PC to the device.
adb install app.apkSets a APK- file.
adb reboot bootloaderReboots the device to Fastboot mode.

⚠️ Warning: The commands fastboot oem unlock or fastboot flash can lead to data loss or soft-brick if executed incorrectly. Always check firmware compatibility with the device model!

βœ… Install Mi USB Driver drivers

βœ… Enable debugging according to USB in the developer settings

βœ… Connect your phone to your PC with the original cable

βœ… Check the visibility of the device by the adb device command

βœ… Make a backup of the data-->

5. Install custom firmware: TWRP and OrangeFox

Custom Recovery (TWRP or OrangeFox) allow you to install informal firmware, cores and modifications. For Xiaomi, the installation process has its own features:

Step 1: Download the correct version of TWRP

Not all versions of the TWRP are MIUI compatible. For example, this build is suitable for the Redmi Note 11 Pro+ (veux), and for the POCO F4 (munch), another build is suitable. Always check the model's encoded name!

Step 2: Installation via Fastboot

fastboot flash recovery twrp.img


fastboot reboot recovery

If the recavery doesn't start after the reboot and the phone loads into the standard system, MIUI has overwritten the recavery.

  1. Download Disable Force Encryption module (e.g., from here).
  2. Install it via ADB sideload in TWRP.
  3. Disable encryption in TWRP settings (Wipe β†’ Format Data β†’ type β€œyes”).

Step 3: Install custom firmware

Popular firmware for Xiaomi:

  • 🌍 LineageOS – pure Android without unnecessary applications.
  • ⚑ Pixel Experience – firmware with the interface and features of Google Pixel.
  • πŸ”₯ Evolution X is a customizable firmware with support for themes and gestures.

πŸ’‘

Before installing custom firmware, be sure to check its compatibility with your model's coded name (e.g. Redmi Note 12 Pro+ is ruby). Installing firmware for another model will lead to hard-brick!

6. Getting root rights: Magisk and alternatives

Root access gives you full control of the system, but it has nuances on MIUI. The main tool is Magisk, but since 2023 Xiaomi has tightened protection:

Step 1: Installation of Magisk

  1. Download the latest version of Magisk from GitHub.
  2. Copy the Magisk-v26.4.zip file to your phone.
  3. Boot in. TWRP and set ZIP-file.
  4. Reset the device.

Step 2: Root Checking

Install Magisk Manager (or Magisk Alpha for newer versions) and check the status.

  • πŸ”„ Reinstall Magisk with the Direct Install option.
  • πŸ› οΈ Check if the antivirus (e.g., Mi Security) is blocking access to su.
  • πŸ“± Update the firmware core (sometimes installing a custom core, such as FrancoKernel, helps).

⚠️ Warning: On HyperOS devices (e.g. Xiaomi 14), Magisk may not work due to the new AVB 2.0 protection mechanism. In this case, you will need to roll back the firmware to MIUI 14 or use alternative methods such as KernelSU.

7.Recovery from Errors: Soft-brick and Hard-brick

Even experienced developers face a β€œbricking” of devices, and let’s look at how to restore Xiaomi in different scenarios:

Soft-brick (device is turned on but not loaded)

Symptoms: getting stuck on the MI logo, cyclical reboot, No OS installed error.

Decision:

  1. Download to Fastboot (Loudness Down + Nutrition).
  2. Fastboot Flash boot boot.img fastboot flash system.img fastboot reboot
  3. If the error persists, reset completely via fastboot erase userdata.

Hard-brick (the device does not respond to buttons)

Symptoms: black screen, no response to charging, PC does not detect the device.

Decision:

  • πŸ”Œ Connect your phone to charge for 30 minutes - sometimes waking up the power controller helps.
  • πŸ”§ Use the EDL Mode (Emergency Download Mode) with a Qualcomm box (e.g., UFED or EasyJTAG).
  • πŸ“ž Contact Xiaomi Service Center – some models (such as the Redmi Note 10 Pro) can be restored through an authorized Mi Account.
What if the Mi Flash Tool is 0x8007010b error?
This error means that the firmware version is incompatible with your model. Solution: 1. Check the device's encoded name (e.g., sweet for the Redmi Note 10 Pro). 2. Download the firmware specifically for your model from Xiaomi Firmware. 3. Select the Clean All option in the Mi Flash Tool instead of Clean All and Lock (so you don't block the bootloader again).

8. Optimizing Xiaomi for App Development

If you’re developing Android apps, Xiaomi can be a powerful tool thanks to its high performance and support for all modern APIs.

Configuring the development environment:

  • 🐍 Install Android Studio and set up an emulator with a Xiaomi profile (e.g., Redmi K60 Pro with a resolution of 3200Γ—1440).
  • πŸ“¦ Enable Do not turn off background processes in the developer settings to debug applications without restarting.
  • πŸ” Turn off battery optimization for Android Studio and debugging apps (Settings β†’ Battery β†’ Battery Optimization).

Challenges and solutions:

Problem.Decision
ADB: device unauthorizedThe phone will be asked for debugging permission - confirm it.
The app is painted on MIUI, but works on other devicesCheck conflicts with MIUI Optimization (disable in the MIUI Optimization developer settings).
Wireless ADB is not working.Connect via USB, run adb tcpip 5555, then turn off the cable and connect via Wi-Fi.

⚠️ Warning: MIUI has Second Space enabled by default, which can interfere with debugging. Turn it off in Settings β†’ Special Features β†’ Second Space.

πŸ’‘

To test applications on Xiaomi, use Freeform mode, which allows you to run applications in an arbitrary window size. Enables through Settings β†’ Special Features β†’ Freeform.

FAQ: Frequent questions

Can I unlock a bootloader on Xiaomi without losing data?
No. Officially unlocking through the Mi Unlock Tool always results in a full reset (factory reset).The only way to save data is to back up through adb backup or TWRP (if the recoveries are already installed).
Why did Magisk lose access to banking applications after installing it?
Banking applications (e.g. Sberbank Online or Tinkoff) block work on root devices. Solutions: Hide root via Magisk Hide (newer versions - DenyList); Use the Universal SafetyNet Fix module; Install the banking application in an isolated profile via Island or Shelter.
How to find out the coder name of your Xiaomi model?
There are several ways: Type in the dialer ##4636## and find Model Number. Look at Settings β†’ About Phone β†’ Device Model (e.g. 22101316C for Redmi Note 12 Pro+). Use the command adb shell getprop ro.product.device. Then find the coder name match on the Xiaomi Device website.
What if the sensor or camera doesn’t work after the firmware?
This is a typical problem when installing an incompatible firmware or kernel. Solutions: Install the correct firmware version for your model (check the coded name!). Run the stock kernel through Fastboot: fastboot flash boot boot.img If the problem persists, complete the reset via fastboot erase userdata.
Can I return the official warranty after unlocking the bootloader?
Technically, yes, but with reservations: Lock the bootloader back through the Mi Flash Tool (Clean All and Lock option). Install the official firmware. Reset the unlock counter (on some models it is possible through Fastboot commands). However, Xiaomi can detect traces of unlocking on the logs, so warranty repair in this case is unlikely.