A Practical Guide to Flashing TWRP on Xiaomi Mi A2

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 1

Looking for a practical guide to installing TWRP custom recovery on Xiaomi Mi A2 codename Jasmine_sprout. The device boasts similar hardware specifications to the Mi 6X codename Wayne. However, instead of running MIUI, the Mi A2 runs Android One.

We think we had enough talking about the advantages of Android One compared to MIUI. One of which is the easiness in the bootloader unlocking process.

While MIUI requires official permission from Xiaomi team, Android One requires none. You don’t need to apply for permission from either Google or Xiaomi just to unlock the bootloader of your very own phone.

However, some parts of different system architecture found in Android One make certain tasks of modification different from what in the MIUI. The existence of A/B partitions is one of good examples.

This small difference, unfortunately, makes the process of flashing TWRP slightly unconventional. It means that you no longer be able to use the “fastboot flash recovery whatever-thetwrpfilenameis.img” command.

How exactly is the way we can flash TWRP on Xiaomi Mi A2? Find the answer down below.

This tutorial shows you the appropriate method of installing TWRP either official or unofficial build on Mi A2. Which one is better?

We cannot say one is better than another since we believe all the features of both builds are similar. It’s just a matter of an individual’s taste and compatibility.

The unofficial TWRP build is made available by a member of Russian forum 4PDA. A member called editedd4e8ede8f1f2 maintains the build. This build sports following key features:

- Android 9.0 Pie-based kernel with full decryption support.
- Mounting of /data partition is made automatically
(if no lockscreen protection set)
- Otherwise, the appropriate unlocking sequence is necessary.
- Slot (A/B) switching works.
- MTP and ADB sideload work.

Furthermore, the unofficial build mounts system partition as “/system” (not as “/system_root“) to comply with the script of OpenGApps installer.

On the other hand, the official TWRP is maintained by XDA member Manish4586. His build can easily decrypt Android’s data encryption mechanism if flashed on Oreo-based Android One ROM.

Unluckily, the developer seems not updating this feature for Android 9.0 Pie ROM. Time availability issues and his opinion about no-decryption found in custom ROMs are the main reasons.

That’s exactly why we could say that both of TWRP builds are different but similar. It doesn’t matter which build you choose and we still recommend you to format data partition for safety purpose.

Let’s get started.

Requirements

You’ll need:

Caution:

It is advise-able to create a backup of all important files and data locally. We hold no responsibility for any damage that may happen to your device.

Moreover, make sure the battery of your phone has enough juice. Charge the battery to at least 60%.

HOW TO FLASH TWRP ON Mi A2

Initial steps are meant to install the necessary drivers properly. However, you may skip them and jump directly to step 4.

Step 1. Disable Windows Drivers Signature Enforcement on your computer. This step is not mandatory but is recommended to ensure the drivers being installed properly. We have the detailed tutorial here.

Step 2. Extract Xiaomi ADB Fastboot Driver zip file (miui-ADB-Driver-Installer-v1.4.3.zip) and install it on your computer. This step is necessary to install ADB Fastboot system-wide. Make sure you install it on C:\adb\.

Step 3. Unlock the bootloader of your phone. Read the full guide on how to unlock the bootloader of Android One here. Please be aware that the process requires you to reset your phone. All your data will be lost. Unlocked already? Jump to the next step.

Step 4. Download and extract the TWRP Installer Pack: OFFICIAL-TWRP-v3.3.1-0-MIA2.zip or UNOFFICIAL-TWRP-v3.3.1-5-MIA2.zip. You’ll get a new folder named “platform-tools“.

Step 5. Enable USB Debugging option on your phone. We believe that you enabled it during the bootloader unlocking process. However, it is better to double-check it.

Go to:

Settings >> System >> Developer Options >> enable the "USB Debugging" option.

Couldn’t find the Developer Options? Go to:

Settings >> System >> About phone >> Tap the Build Number several times >> congratulation you are a developer.

Step 6. Connect your Mi A2 phone to the computer using its USB cable.

Step 7. Hold down the Shift key on the keyboard and right-click anywhere inside the “platform-tools” folder. Choose “Open Command Prompt Window Here” or “Open PowerShell Window Here”.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 2

Step 8. Now type following command and hit Enter after each line:

adb devices
adb reboot bootloader
fastboot devices

What does it mean of each line of command issued?

The first command asks ADB to list all attached Android devices. The next command asks ADB to reboot the connected phone into bootloader mode in which most MIUI users know it as Fastboot mode.

The familiar Fastboot logo shall appear:

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 3

The last command asks the computer to establish the Fastboot connection and to list devices attached.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 4

Step 9. Issue command below to boot your phone into TWRP.

If you choose the official TWRP build:

fastboot boot twrp-3.3.1-0-jasmine_sprout.img

If you choose the unofficial TWRP build:

fastboot boot twrp-3.3.1-5-jasmine_sprout-unofficial.img

Either one will boot your phone into the TWRP recovery. This shall finish in a few seconds.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 5

Step 10. Do the “Swipe to allow system modification” since this is the first time booting to TWRP.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 6

Step 11. Choose “Advanced” from the TWRP main menu.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 7

Step 12. Choose “ADB Sideload” then do the “Swipe to Start Sideload“.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 8

Step 13. Get back to the computer and type the following command:

adb sideload twrp-installer-3.3.1-0-jasmine_sprout.zip

Use this command if you choose the unofficial build:

adb sideload twrp-installer-3.3.1-5-jasmine_sprout-unofficial.zip

Voila! The TWRP will be sideloaded (installed) on your Mi A2 phone.

If your Mi A2 is running Android One ROM v10.0.12.0 or newer, both the official and unofficial TWRP cannot decrypt storage /data partition. If you set any lockscreen protection such as PIN, Password, fingerprint, or faceunlock, the /data partition will be encrypted.

The unofficial TWRP build may be able to automatically decrypt the /data partition if your phone is running ROM older than version 10.0.12.0 (both Oreo and Pie ROM).

The official TWRP build v3.3.1-0 can only decrypt ROM based on Android Oreo. Some users reported the official build can also decrypt the partition on the Pie ROM tho.

However, since we warned you about the possibility of losing data and hence we asked you to create a backup, it is better to wipe the /data partition whether the /data partition is encrypted or not.

How to Fix TWRP Decryption Issue

Step 1. Boot into TWRP recovery (if you haven’t done it yet). Turn off the phone completely. Press both Power button and Volume Up button simultaneously. Skip this if your phone is already in the TWRP recovery mode.

Step 2. Choose “Wipe” from the main menu.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 9

Step 3. Choose “Format Data” then type “Yes” to confirm.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 10

Step 4. Go back to the main menu of TWRP once the process of formatting the /data partition completed.

Step 5. Choose “Mount” then tap the “Enable MTP” option.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 11

Step 6. Connect your phone to the computer. Skip this if your phone is still connected.

Step 7. Copy the downloaded “Disable_Dm-Verity_ForceEncrypt_08.18.2019.zip” file to the phone storage. Doing so is easy. Simply copy-and-paste it in the Windows Explorer, like you usually do with a USB flash drive.

Step 8. Now choose “Install” from the main menu of TWRP.

Step 9. Locate the copied “Disable_Dm-Verity_ForceEncrypt_08.18.2019.zip” file and tap on it to select it.

Step 10. Finally, do the “Swipe to confirm flash” action.

A Practical Guide to Flashing TWRP on Xiaomi Mi A2 12

Step 11. Now you are safe to boot into normal system again. Simply choose “Reboot” then choose “System“.

How to Root Xiaomi Mi A2 on Android One

At this point, rooting your Mi A2 is just a piece of cake since you already have the TWRP installed.

Follow these steps:

Step 1. Open up your favorite web browser in your phone (Chrome, Firefox, Opera, UC Browser, etc).

Step 2. Download the latest Magisk zip file from this link. Usually, the downloaded zip file will be stored in the Downloads folder.

Step 3. Turn off the phone completely. Press both Power button and Volume Up button simultaneously to reboot into TWRP recovery again.

Step 4. Choose “Install” from the menu.

Step 5. Find the Magisk zip file (e.g: Magisk-v19.3.zip). Normally, the downloaded Magisk zip file resides in the Downloads folder.

Step 6. Tap on the filename to select it.

Step 7. Now do the “Swipe to confirm flash” action.

Step 8. Sit tight and wait for the TWRP to flash Magisk.

Step 9. Finally, choose “Reboot” then choose “System“.

Step 10. Enjoy! You’ll notice a new app called Magisk Manager.

Optionally, you can download and install Root Checker app to confirm the root status.

Possible Issues:

Cannot boot into the system (bootloop) after flashing TWRP:
Try flashing DM-Verity and Force Encrypt zip file again.

Cannot boot into the system (bootloop) after flashing Magisk:
Try flashing Magisk and DM-Verity and Force Encrypt zip file again.

The phone is rooted but no Magisk app installed:
Download Magisk Manager APK file here and install it.

Leave a Reply