Reflashing Xiaomi Mi 4: official and custom methods with unlocking the bootloader

Xiaomi Mi 4, released in 2014, is still a popular device among Android enthusiasts thanks to the powerful hardware (Snapdragon 801, 3 GB of RAM) and active support for custom firmware. However, with the release of new versions of MIUI and Android, official updates for the model have long been discontinued. Firmware reflashing allows not only to update the system to current versions, but also to eliminate the brakes, expand the functionality or even install LineageOS for pure Android.

In this guide, we will analyze all the current ways of flashing – from the official update via Updater to install custom builds via TWRP. Particular attention will be paid to unlocking the bootloader on the Mi 4, taking into account changes in Xiaomi policy from 2023 to 2026, since without this step, installing alternative software is impossible, and you will find solutions to typical errors (for example, Error: 7 in TWRP or β€œhang” on the Mi logo).

1. Firmware Preparation: What You Need to Know Before Starting

Reflashing Xiaomi Mi 4 is a process that requires care. Errors at any stage can lead to a device "brick" (inoperability).

  • πŸ”„ Why do you need firmware? Update to the new version MIUI, switching to custom build (e.g. Pixel Experience) or eliminating system lags?
  • πŸ“± What version? MIUI Is it set now? Check in the settings β†’ The phone. β†’ Version. MIUI. For older versions (below) MIUI (10) a firmware intermediate may be required.
  • πŸ”“ Is the bootloader unlocked? If not, it will have to be unlocked (see section 3).
  • πŸ’Ύ Is there a backup? Firmware erases all data! Use Mi Cloud or Titanium Backup (requires root).

Important: Xiaomi Mi 4 has two modifications - Mi 4 LTE (cancro) and Mi 4 3G (cancro). Make sure you download the firmware for your model! You can not install software from another modification - this will lead to an error Error: 7 in TWRP.

⚠️ Note: If your Mi 4 was purchased in China, there is a high probability that it has a locked bootloader with a link to the Mi Account. In this case, unlocking through the official Mi Unlock tool may not work – you will need a workaround method (described in section 3).

πŸ“Š What firmware you plan to install on Xiaomi Mi 4?
Official MIUI (Stable/Developer)
LineageOS (Pixel Experience)
Stock Android (AOSP)
Another.

2. firmware selection: official MIUI vs custom builds

The type of firmware depends on the functionality of the device, performance and even its lifespan. Consider the main options for the Xiaomi Mi 4:

Type of firmwareAdvantagesDeficienciesRecommended version
Official MIUI (Stable)Maximum stability, OTG support, optimization for ironOutdated version of Android (maximum 6.0), lots of bloatwareMIUI 10.2.1.0 (Android 6.0)
MIUI for DevelopersNew features, weekly updatesBugs, possible lags, unstable workXiaomi.EU (unofficial)
Castomic (LineageOS)Up-to-date Android (up to 11), no Bloatware, high performanceIt may not work: NFC, IR-blaster, some sensorsLineageOS 16 (Android 9)
Pixel ExperiencePure Android with chips from Google PixelLess optimization for iron, camera bugs are possiblePixelExperience 10 (Android 10)

For most users, LineageOS 16 or Pixel Experience 10 are the best choice, offering a balance between Android relevance and stability, IR-blaster for control equipment, it is better to stay on the official MIUI 10.

Where do I download firmware?

  • πŸ“₯ Officially MIUI: Xiaomi website (select the Global or China region depending on the model).
  • 🌍 Castomy: section Mi 4 on XDA or Xiaomi.EU.
  • βš™οΈ Tools: TWRP For the Mi 4, Mi Unlock Tool.

πŸ’‘

Before downloading the firmware, check its hash amount (MD5) using the HashMyFiles utility. This will save you from downloading corrupted files that can cause installation errors.

3. Unlock the bootloader on Xiaomi Mi 4 (2026 method)

Since 2016, Xiaomi has tightened its bootloader unlock policy. For the Mi 4, the process is complicated by the fact that the model is old, and the official Mi Unlock Tool tool may not recognize the device.

Link your Mi Account to your device (Settings β†’ Mi Account)

Enable debugging via USB (Settings β†’ About Phone β†’ MIUI Version β†’ 7 times tap β†’ Developer β†’ USB Debugging)

Turn it on. OEM-unlocking (Settings) β†’ Additionally. β†’ For developers β†’ Unlocking OEM)

Install ADB/Fastboot drivers on PC (download from Android site)

Download Mi Unlock Tool (version no lower than 5.5.224.30)

-->

Step 1. Linking your Mi Account

Without a Xiaomi account, unlocking is not possible. Go to Settings β†’ Mi Account and log in. Then go to Settings β†’ Additional β†’ Developer and activate:

  • πŸ”— Unblocking status (a notification of account binding should appear).
  • πŸ”“ Unlocking OEM (If there is no option, update it. MIUI until the last available version).

Step 2: Launch the Mi Unlock Tool

Connect the Mi 4 to your PC in Fastboot mode (turn off the phone, then press Volume Down + Power).

  1. Sign in with the same Mi Account as you do on your phone.
  2. Press Unlock and wait for the check (can take up to 10 minutes).
  3. If you have a Couldn’t unlock error, try it.
  • πŸ”„ Reconnect. USB-cable (use the original cable!).
  • πŸ–₯️ Run Mi Unlock Tool on behalf of the administrator.
  • πŸ“… Wait 72–168 hours (if the account is new, Xiaomi will temporarily block the account).

⚠️ Note: If the Mi Unlock Tool gives an error This device is locked even after all the manipulations, try the bypass method via fastboot oem unlock-go (works on some versions). MIUI). Details - in spoiler below.

Bypass unlock method (for experienced users)
If the official tool doesn’t work, you can try unlocking the bootloader via the fastboot oem unlock-go command. 1. Put the phone in Fastboot mode. 2. Open the command prompt in the folder with platform-tools. 3. Enter: fastboot oem unlock-go 4. Confirm the unlock on your phone (if you receive a request). ⚠️ Risk: This method can result in a device reset or Mi! account being blocked.

4. Install TWRP Recovery on Xiaomi Mi 4

TWRP (Team Win Recovery Project is a custom recovery required to install unofficial firmware. 4 recommended 3.6.1_9-0, Newer assemblies may not support older iron.

Installation instructions:

  1. Download the TWRP image for Mi 4 and rename it twrp.img.
  2. Place the file in the folder with the platform-tools (where fastboot.exe is located).
  3. Transfer the phone to Fastboot mode (clip Volume Down + Power).
  4. Open the command line in the folder with platform-tools and execute: fastboot flash recovery twrp.img fastboot boot twrp.img

Once installed successfully, the phone will automatically reboot to TWRP. Important! Don't reboot the device immediately - first perform a data reset (Wipe β†’ Format Data), otherwise there may be firmware errors.

πŸ’‘

Installation TWRP To get it back, you can swipe the official image through Fastboot with the fastboot flash recovery command. stock_recovery.img (The file can be extracted from the official firmware).

5. Xiaomi Mi 4 firmware: step-by-step instructions

The way the firmware is installed depends on the type of software being installed, and below are the instructions for all scenarios.

5.1 Install official MIUI via Fastboot

This method is suitable for updating or rolling back to stock firmware.

  • πŸ“ Firmware in.tgz format (download from the official website).
  • πŸ–₯️ Mi Flash Tool (download here).

Steps:

  1. Unpack the firmware in a folder without Cyrillic symbols.
  2. Transfer the phone to Fastboot (Loudness down + Power).
  3. In Mi Flash Tool, click Select, specify the folder with the firmware.
  4. Select Clean All (full reset) or Clean All and Lock (reset + lock bootloader).
  5. Press Flash and wait until it is completed (5-10 minutes).

5.2 Installation of custom firmware via TWRP

For LineageOS, Pixel Experience or other custom builds:

  1. Download the firmware (.zip format) and, if necessary, Open GApps (choose arm β†’ 9.0 β†’ pico for Android 9).
  2. Reboot to TWRP (Loudness Up + Power).
  3. Run the Wipe. β†’ Advanced Wipe and mark: πŸ—ƒοΈ Dalvik / ART Cache πŸ“ System πŸ“„ Data πŸ”„ Cache

Install

Open GApps

Wipe β†’ Format Data

Reboot β†’ System

⚠️ Note: If the sensor does not work after the LineageOS or Pixel Experience firmware, download and run through TWRP The problem is related to the incompatibility of drivers in new versions of Android.

Typical errors and their solutions

Even with the exact following of the instructions, there can be problems.

Mistake.Reason.Decision
Error: 7 in TWRPIncompatibility of firmware with the device modelCheck that you downloaded the firmware for cancro (Mi 4). If the error persists, edit the updater-script in the firmware archive (delete the line with the model verification).
Hanging on the Mi logoIncorrect Wipe or damaged boot.imgGo back to TWRP, run Format Data, then run the firmware, and if it doesn't work, run boot.img separately through fastboot flash boot.img.
Couldn't unlock in Mi UnlockMi Account is not tied to device or temporarily blockedWait 72 hours, check your account’s link to Settings β†’ Mi Account. If it doesn’t work, use the workaround method (see Section 3).
No network after firmwareNo modem files or incorrect firmware versionSweat the official MIUI through Fastboot, then re-install custom firmware. Or download separately modem for your model.

If your error is not described above, check the logs in TWRP (Advanced β†’ Copy Log) and ask a question on 4PDA or XDA, attaching a screenshot of the error.

7.Optimize the Mi 4 after firmware

After successful firmware, it is recommended to perform several actions to improve performance and stability:

  • ⚑ Turn off animation: Go to Settings β†’ For developers and install: Animation windows β†’ Off. Transition animations β†’ Duration of the animator β†’ 0.5x
  • πŸ”‹ Battery calibration: After firmware, reset battery statistics through TWRP (Wipe β†’ Battery Stats. Then fully discharge and charge the phone 2-3 times.
  • πŸ›‘οΈ Turn off unnecessary services: In LineageOS or Pixel Experience, turn off: πŸ“‘ Wi-Fi Scanning and Bluetooth Scanning (Saves Charge). πŸ“ Auto-Update Apps in Play Market.
  • πŸ”„ Cache cleanup: Once a month clean Dalvik Cache through TWRP (Wipe β†’ Advanced Wipe β†’ Dalvik).

For additional acceleration, you can install the FrancoKernel core (available for the Mi 4 on XDA), which optimizes the processor and reduces heat.

8. Frequently Asked Questions (FAQ)

❓ Can I flash Xiaomi Mi 4 without unlocking the bootloader?
No. Installing any unofficial firmware (including LineageOS or Pixel Experience) requires an unlocked bootloader.The only exception is an Updater update in the official MIUI, but that won't give you new versions of Android.
❓ How to return stock recovery after installation TWRP?
Download the official firmware for your model, extract the recovery.img file from it (usually in the image folder), then run it through Fastboot: fastboot flash recovery.img After that, the stock recovery will be restored, but the bootloader will remain unlocked.
❓ Why does LineageOS not work after the firmware?
Some LineageOS builds for the Mi 4 lack proprietary camera drivers. Solutions: Install alternative camera software, such as Google Camera (download here). TWRP.
❓ Can I flash Xiaomi Mi 4 on Android 11 or later?
Technically yes, but with reservations: πŸ“± Android 11: Available via Pixel Experience 11, but performance and sensor bugs are possible. 🚫 Android 12+: No stable builds due to iron limitations (the Snapdragon 801 processor does not support new kernel versions.
❓ How to Backup Current Firmware Before Updating?
V TWRP Select Backup and mark sections: πŸ“ Boot πŸ—ƒοΈ System πŸ“„ Data (if you need to save applications) Backup is saved to a memory card or internal memory. To restore, use Restore in the TWRP.