How to flash Xiaomi Mi 4: official and custom MIUI, unlock the bootloader

Why would you want to run Xiaomi Mi 4 in 2026?

Smartphone Xiaomi Mi 4, released back in 2014, still remains in service with many users – thanks to reliable hardware (Snapdragon 801, 3 GB of RAM) and active support for enthusiasts. However, official updates for this model have long been discontinued, and the latest stable version of MIUI 9 based on Android 6.0 Marshmallow no longer meets modern security and functionality requirements.

Xiaomi Mi 4 firmware in 2026 is relevant for three key reasons: 1) Install custom firmware (LineageOS, Pixel Experience) to get the current Android 10/11 with support for new applications. 2) Eliminate the β€œbrakes” and bugs in the old MIUI by switching to optimized builds (for example, MIUI 12.5 from third-party developers). 3 Unlocking the potential of the device: disabling advertising in MIUI, installing Google Camera (GCam) or kernels with improved autonomy.

This article is the only up-to-date firmware guide for Xiaomi Mi 4, taking into account changes in Xiaomi’s policy (closing old unlock servers in 2023) and newer versions of tools.

Preparation for firmware: what to do before the start

Incorrect preparation is the main reason for the β€œbricking” Xiaomi Mi 4. Before firmware, be sure to follow 4 steps:

  • πŸ”‹ Charge the battery to minimum. 70%. When discharged during firmware through Fastboot, the device can turn into a β€œbrick” with an error. EMPTY_BATTERY.
  • πŸ“± Make a backup of the data through Settings β†’ Additionally. β†’ Backup or TWRP. The internal memory will be formatted!
  • πŸ–₯️ Install Mi drivers USB Driver and ADB/Fastboot Without them, Windows will not recognize the smartphone in firmware mode.
  • πŸ”“ Unlock the bootloader (if not done earlier). Since 2023, Xiaomi has tightened the procedure - now you need to link your Mi Account to the device.

Pay special attention to the version MIUI, It's on the phone. MIUI Global Stable is older than 8.0, first upgrade to MIUI 9.6.3.0 via the phone β†’ System update – otherwise MiFlash will refuse to stitch the device with an error anti_rollback.

πŸ“Š What kind of firmware do you plan to install?
Official MIUI
LineageOS
Pixel Experience
Another custom
I don't know.

Method 1: Firmware via MiFlash (official MIUI)

This method is suitable for installing stock firmware (original MIUI) and recovering the device after a crash. Use the official MiFlash tool and Fastboot mode.

Step-by-step:

  1. Download the firmware archive for Xiaomi Mi 4 (codename cancro). Choose the Fastboot version (file with.tgz extension).
  2. Unpack the archive in a folder without Cyrillic characters (for example, C:\Mi4_Flash).
  3. Turn off the phone, then press Volume Down + Power to enter the Fastboot (the image of a hare in a hat will appear).
  4. Connect your smartphone to your PC and start MiFlash. In the program, press Select, specify the path to the firmware folder, then Refresh β€” the device should be defined as COMX.
  5. At the bottom, select Clean All or Clean All and Lock (if you want to lock the bootloader after you have firmware).

It takes 3-7 minutes. Upon completion, the phone will automatically restart. If this MIUI version cannot be installed on this device appears after the firmware, then you are trying to install an older version of MIUI than the one that was previously (anti-Rollback protection).

Download the official Fastboot-ROM for cancro|

Qualcomm HS-USB QDLoader 9008| drivers installed

Phone in Fastboot mode (hare in hat)|

MiFlash is in Clean All| mode

Antivirus is disabled (it can block) flash_all.bat)-->

Method 2: Install custom firmware through TWRP

To install LineageOS, Pixel Experience or modified MIUI will require custom TWRP recavators. Important: on the Xiaomi Mi 4 only version 3.2.3-0 or later with treble support is running.

Algorithm of action:

  1. Unlock the bootloader (instructions in the next section).
  2. Download. TWRP For cancro (.img file) and run it through Fastboot with the command: fastboot flash recovery twrp-3.6.2_cancro.img fastboot boot twrp-3.6.2_cancro.img
  3. In TWRP, backup Boot, System, Data (click Backup β†’ Select Partitions β†’ Swipe for confirmation).
  4. Sweep through custom firmware (.zip file): Install β†’ Select file β†’ Swipe.
  5. For GApps (Google Services) and Magisk (root), repeat step 4 after installing the main firmware.

After the first custom firmware download, wait 10-15 minutes for the system to optimize the applications. If the phone has been stuck on the logo for longer than 20 minutes, then the firmware is incompatible with your version of MIUI (you should have flashed stock-ROM through MiFlash first).

How to check the compatibility of custom firmware?
Open the firmware archive (.zip) and find the updater-script file(xiaomi.verify_treble("cancro") == "If it is not, the firmware does not support your device. Also check the Android version in the file name (for example, check the name of the file, lineage-18.1-20230510 = Android 11).

Unlocking the bootloader on Xiaomi Mi 4 in 2026

Since 2023, Xiaomi has changed the unlocking process: it now requires a Mi Account to be linked to the device and waiting 72-168 hours (previously 72 hours guaranteed).

  1. Turn on About Phone β†’ MIUI version (click 7 times to activate Developer Mode).
  2. Go to Settings. β†’ Additionally. β†’ For developers and include: πŸ”— Debugging by USB πŸ”“ Unlocking OEM (crucial!)

Mi Unlock Tool

Mi

Mi 4

Fastboot

Unlock

Couldn’t unlock

Once successfully unlocked, the bootloader will remain open until you sew the clean all and lock device into MiFlash.

1) Re-link the account to Settings β†’ Mi Account β†’ Sign out, then log in again.

2) Use another PC (sometimes the lock is associated with IP-address).

3) Wait 24 hours – sometimes Xiaomi servers delay synchronization.-->

Solving errors when firmware Xiaomi Mi 4

Even if you follow the instructions accurately, you can get errors, and here's a table of the most common problems and solutions.

Mistake.Reason.Decision
remote: device is lockedThe bootloader is not unlockedUnlock the device through the Mi Unlock Tool (see section above)
This package is for "cancro" devices; this is a ""The firmware is not designed for the Mi 4Download the correct version (codename cancro)
E3004: Preflash validation failedFirmware file damaged or space missingCheck the archive checksum (MD5) and format internal memory
The phone does not turn on after the firmwareThe incompatible version of MIUI (Anti-Rollback)Sweat through MiFlash with a newer version, then try again.

If after firmware Xiaomi Mi 4 got stuck on the MI logo or reboots in the loop (bootloop), try:

  1. Go to TWRP (clip Volume Up + Power when turned on).
  2. Execute Wipe β†’ Format Data (enter yes to confirm).
  3. Re-swipe the firmware.

πŸ’‘

If the IMEI is lost after the firmware or the network is not working, then the modem partition is damaged. Restore it through TWRP by scanning the modem.img file from the official MIUI.

Selection of firmware: which MIUI or custom ROM to install

The choice of firmware depends on the performance, autonomy and functionality of the Xiaomi Mi 4. Below is a comparison of popular options:

  • πŸ“¦ Official. MIUI (Global/China Stable: The most stable option, but no security updates β€” MIUI 9.6.3.0 (Android 6.0). Suitable for everyday use without tweaksΒ».
  • πŸ”„ MIUI 12.5 from xiaomi.eu: An unofficial port with features MIUI 12.5 based on Android 10. Pros: modern interface, no advertising. Cons: possible bugs with the camera.
  • πŸ€– LineageOS 18.1 (Android 11): Pure Android without shell MIUI. Pros: current security patches, high speed. Cons: no branded features Xiaomi (for example, Second Space).
  • πŸ“± Pixel Experience: Firmware with Google Pixel interface and pre-installed GCam.Perfect for photographers, but can brake on weak hardware.

For maximum performance, we recommend LineageOS 17.1 (Android 10) – it is optimized for Snapdragon 801 and consumes less power than MIUI. If Xiaomi functionality is important (for example, Game Turbo or Theme Store), choose MIUI 12.5 from Xiaomi.eu.

πŸ“Š What is the priority when choosing a firmware?
Speed and stability
The relevance of Android
MIUI functions
Camera and multimedia
Other

FAQ: Frequent questions about the firmware Xiaomi Mi 4

Can I flash Xiaomi Mi 4 without unlocking the bootloader?
Any firmware other than the About phone update. β†’ Updating the system requires an unlocked bootloader. OTA-The updates are long overdue for the Mi 4.
How to return the official MIUI after custom firmware?
Download Fastboot-ROM for your model from the official website, then swipe through MiFlash in clean all mode. If the phone does not turn on after that, repeat the firmware with the clean all and lock tick.
Why is the camera or network not working after the firmware?
This is a typical problem when installing custom firmware. Solutions: For the camera: run the vendor.img file separately from the official MIUI. For the network: check the IMEI (enter *#06#) and restore the modem partition if necessary.
How long does the firmware take?
Time depends on the method: MiFlash (Fastboot): 3-7 minutes. TWRP (Castom firmware): 5-15 minutes + 10-20 minutes for the first download. Unlock the bootloader: up to 7 days (waiting for confirmation from Xiaomi).
Can I flash Xiaomi Mi 4 on Android 12 or later?
Technically yes, but not recommended.Snapdragon processor 801 Doesn't support Android 12+ It's going to be lag, overheating and fast battery drain. Android is the best choice. 10/11 (LineageOS 18.1).

πŸ’‘

Before you run your firmware, always check reviews about a particular build on the 4PDA or XDA Developers forums. Some firmware may contain hidden mining modules or spyware!