The Custom Droid

Android Tutorials, Tips and Tricks

How to Unlock Bootloader on Xiaomi Mi A2/A2 Lite

How to Unlock Bootloader on Xiaomi Mi A2/A2 Lite

An unlocked bootloader is vital if you wish to install custom ROMs, kernels, mods, or a custom recovery like TWRP. Follow this comprehensive guide on how to unlock the bootloader on Xiaomi Mi A2/A2 Lite using Fastboot.


The Xiaomi Mi A2 and the A2 Lite are successors to last year’s Mi A1. Following its footsteps, the all-new Mi A2 also comes as a part of the Android One program. Despite being offered the clean stock Android experience, users might often crave for additional features. Like flashing Magisk Modules, installing mods like ViPER4Android and Dolby Atmos for enhanced audio, using root-enabled applications, etc. Most of these things rely on a custom recovery such as TWRP and/or root. But before you can even install TWRP or root, you must first unlock the bootloader on Xiaomi Mi A2/Mi A2 Lite.

Unlike other Xiaomi phones, unlocking the Mi A2/A2 Lite bootloader does not require the Mi Unlock tool. This means you do not need to have a registered Mi account and neither do you have to wait for days to finally unlock the bootloader. Rather, the process is much simpler and only requires you to execute the dedicated fastboot unlock command. We have prepared this tutorial to take you through the process in a step-by-step manner.


  • Unlocking the bootloader on the Mi A2 and Mi A2 Lite will wipe all the data stored on the device. We will still strongly suggest you take a full backup of all your data. This shall help you avoid any data loss in-midst or post the process.
  • Charge the phone to a sufficient battery level (60% or above) to avoid any sudden shutdowns during the unlock process.
  • You must install and set up Android platform-tools on the PC. You can follow our tutorial for doing this manually or use the Minimal ADB and Fastboot tool to automate the process.
  • Download and install Xiaomi USB drivers on the PC.

How to to Unlock Bootloader on Xiaomi Mi A2/A2 Lite

  1. Power off your Mi A2/Mi A2 Lite completely.
  2. Boot your Mi A2 into Fastboot Mode.
    Unlock Bootloader on Xiaomi Mi A2/A2 Lite - Fastboot Mode
  3. Connect the phone to your PC while it is in Fastboot Mode.
  4. Go to C:\platform-tools on the PC where the ADB and Fastboot binaries are present.
  5. Hold the SHIFT key on the keyboard and right-click on an empty space inside the folder.
  6. Select ‘Open PowerShell window here’.
    Unlock Bootloader on Xiaomi Mi A2/A2 Lite - Open PowerShell window here
  7. Verify the connection between the device and the PC using:
    .\fastboot devices


    ./fastboot devices
  8. The command should output the device ID along with the ‘fastboot’ message. If not, then make sure that you have properly installed the USB drivers.
  9. Now, unlock the bootloader on your Xiaomi Mi A2/A2 Lite using the following command:
    .\fastboot flashing unlock


    ./fastboot flashing unlock
  10. As soon as the command is executed, the confirmation prompt will appear on the phone’s screen.
    Unlock Bootloader on Xiaomi Mi A2/A2 Lite - Warning Message
  11. Use the Volume keys to highlight ‘UNLOCK THE BOOTLOADER‘ and press the Power button to confirm the unlock process.
  12. The phone should automatically boot into the OS.
  13. Now, reboot your Mi A2/A2 Lite back into the Fastboot Mode and enter the following command to further unlock the critical partitions for the phone:
    1. On Windows:
      .\fastboot flashing unlock_critical
    2. On macOS/Linux:
      ./fastboot flashing unlock_critical
  14. As soon as the fastboot command is issued, you’d be prompted to confirm the bootloader unlock on your phone’s screen. Simply use the Volume keys to move the selector to “UNLOCK THE BOOTLOADER” and press the Power key to confirm.

That’s it! The bootloader on your Mi A2/A2 Lite should now be fully unlocked. Once your phone boots into the Android OS, go ahead and follow the on-screen instructions and finish the setup wizard.

With that done, you can go ahead and install TWRP recovery and root Xiaomi Mi A2/A2 Lite. Or, you can also simply root the phone without TWRP, which is best if you want to install OTA updates on rooted phone with Magisk.

We hope that you found this tutorial to be useful and easy. Though, if you have any questions regarding the procedure, then feel free to write to us via the comments section below.

About the Author

Founder and Editor-in-Chief

Dhananjay has more than 11 years of experience in Android software customization and development, and has spent the past 10 years writing about it. He spends most of his prime time reading, learning and writing about Android and other open-source projects. He is also a community-taught web developer. Apart from that, he loves mountain biking and playing video games on his PlayStation.

Comments 26 Comments

  1. Hey guys.
    I have a problem similar to the others, my phone has the bootloader blocked and the developer mode was disabled. The phone after android update was on this boot loop screen. The phone recognizes on the PC but does not allow installation in adb, fastboot or miflash mode via EDL. It does not go into recovery mode because of the block, only in fastboot.

    Ps: Forgive English, I used the translator. Thanks!

    C: \ Arquivos de programas (x86) \ Minimal ADB e Fastboot> fastboot oem unlock

    FAILED (remoto: Flashing Unlock não permitido
    concluído. tempo total: 0,004s

    C: \ Arquivos de programas (x86) \ Minimal ADB e Fastboot> fastboot oem device-info

    (bootloader) Modo Verity: true
    (bootloader) Dispositivo desbloqueado: false
    (bootloader) Dispositivo crítico desbloqueado: false
    (bootloader) Tela do carregador habilitada: true
    OKAY [0,007s]
    concluído. tempo total: 0,007 s

    1. Hey Joao! The bootloader can’t be unlocked without enabling OEM unlocking first. Since you’re not able to enter the OS, it would not be possible to enable it and in turn, you cannot unlock the bootloader.

      Try this: Turn off the phone and then hold the Volume Up and Power keys together. Keep holding them until you see the stock recovery screen. Let me know if it works.

      If you can get the phone into the stock recovery, you might be able to sideload the OTA update and recover your phone from the bootloop. If not, you could try wiping the /data partition by executing the fastboot -w command from your computer. This command will erase all the data on your phone (just like a factory data reset) and may fix the problem.

  2. If I enter the command “adb devices” in Windows Powershell it says that I have to enter “. \ adb devices”. If I then enter it like this: “. \ adb devices”, only “List of devices attached cf16 **** offline.” comes out. (I don’t know if I can post this number online or not, but I censored it anyway.) My device may simply not be recognized by Windows 10, but I don’t know how to fix it. plz help

    Sorry for the bad english

    1. Cornelius, when you type in the adb devices command, you should see a prompt on your phone’s screen to allow USB debugging (Something like shown in this picture).

      When that prompt appears, select “Allow” and then re-run the adb devices command. This time, your device should be online and recognized by your computer over ADB.

  3. Hi,

    I have issue into Mi A2 my phone is struct at Android One Screen, Nothing happen when i reboot or do the fastboot.

    so i am not able to do OEM unlocking from settings.

    is this any way to OEM unlocking using command

    I am not able to unlock device
    this is the log
    C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot oem unlock

    FAILED (remote: Flashing Unlock is not allowed
    finished. total time: 0.004s

    C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot oem device-info

    (bootloader) Verity mode: true
    (bootloader) Device unlocked: false
    (bootloader) Device critical unlocked: false
    (bootloader) Charger screen enabled: true
    OKAY [ 0.007s]
    finished. total time: 0.007s

    1. Dhaval, without enabling the OEM unlocking toggle, it’s not possible to unlock the bootloader. The bootloader will not accept the unlock command and that’s why the toggle is there.

      Are you able to get your phone into Fastboot or Recovery modes? You could check out the instructions here.

  4. thank you for this info.,

    I want to unlock bootloader my Mi A2 for active “camera 2api”., after that can I relock bootloader my Mi A2..?
    what about the settings that I have changed to activate camera 2 api? will it change too and return to the previous settings?

    thank you

    1. Hi Julius. Relocking the bootloader will reverse the commands and thus disable Camera2 API again.

      You will need to keep your phone’s bootloader unlocked. But don’t worry, an unlocked bootloader will not prevent OTA updates.

    2. many thanks for this info., I apologize for checking it now.,
      I wanna ask about security system after I unblock bootloader., some information said that my device will easily be entered by malware.., is that true..?
      thanks for your help

    3. Hi Julius. An unlocked bootloader would allow someone to re-flash the phone’s software, nothing more than that. If the phone is safe with you, there’s nothing to worry about.

      As for the warning, it’s mandatory for manufacturers to show that when the phone boots, so that the users can know that the bootloader is unlocked. It’s normal.

  5. everything was fine according to your instruction. In my Mi a2 Gcam got installed and working fine. then i observed each time i restart the phone ,a pop up warning my bootloader is unlocked. I wantedto lock and fix the same. searched in your comment section and found a command for the same “fastboot oem lock” and after doing this my phone is locked by miui and still could not boot into os. it was mt mistake , i unlocked it through ” fastboot flashing unlock” bit mistakenly locked the phone by oem unlocking. i tried by flashing the stock image followed by critical_unlocking but din,t work. dindn,t boot into os. help me out pl

    1. Hi. So you disabled the ‘OEM Unlocking’ toggle in Settings > System > Developer options?

    2. Hi Dhananjay,
      I can’t relock the bootloader, and from developer settings is unable to touch/set (screenshot: I tried to lock by using “fastboot oem lock” but the phone stuck in android one logo (bootloop), the only way to use my phone is only unlock the bootloader again. My phone is Mi A2 Lite September update and I can’t install october update too, is it because of bootloader still in unlock mode? If so, how do I relock the bootloader without bootloop?
      Thank you

    3. Hi Reynaldi. If your phone fails to boot after relocking the bootloader, then there’s probably some modification that you made to the OS. Did you root your phone/install TWRP previously after unlocking the bootloader?

    4. Hi Dhananjay. Yeah I did a few modification like build.prop (to activate camera2api), and removed some default apps like chrome & feedback. And I rooted & installed twrp on my phone previously, but I already unroot & flash stockboot img first before tried to relock bootloader. Do you know which one that cause bootloop?

    5. Hi again. It’s possibly the build.prop edit. Also, if you removed the apps like Chrome/feedback by mounting the /system partition (using root file manager), then that could be a cause as well.

      If you want to uninstall pre-installed system apps, I’d recommend using the Debloater Magisk module.

      The easiest way now is to flash the stock fastboot image via MiFlash tool. Of course, you will need an unlocked bootloader.

    6. Thanks for your consideration, answering me. As because of lacking the technical knowledge, simply followed your step by step guide and finally installed Gcam 6.2.030 by Urnyx05 , working fine in mi a2.
      “Bootloader is unlocked, Software integrity not guaranteed” Taking a little bit longer time to reboot in os which is the patched boot image of Magisk of October month.

      From boot loop situation I did a custom recovery by factory Data reset by pressing the power button key along with volume up key. Then Again I enable camera 2 API through Termux app by the help of Magisk. Everything is fine again other than the unlocked bootloader.
      Now can I run the banking and stock market app on my phone without any issue? Is my data safe? Will I get the security update? How long this temporary root continue! The time frame? Please guide..

    7. Hi again, Prithwish. I am glad you were able to resolve the bootloop issue all by yourself, well done!

      Now, below I have tried and answer all your questions in the mentioned order:
      1) Yes, you can use banking or any other app that detects root.
      2) Yes, of course it’s safe. Since you’re running the stock firmware without root (You rooted by temporarily booting the patched boot image using “fastboot boot” command, right?), it means that all your data is encrypted.
      3) Yes, you will get monthly security updates and even major Android version updates normally.
      4) The temporary root is removed on the next reboot. That is: Once you have booted the patched boot image, enabled camera2 API and rebooted. The reboot will unroot your phone.

      If you have any more questions, please feel free to reach back.

    8. A big hearty hug . Wish you all the success and happiness, through your vast knowledge keep helping us likewise.💚

    9. Thanks a lot for such kind words, Prithwish. Wish you all the same! I am no expert, but I am constantly learning and evolving to try and be one in the field. Comments like these keep me going, so thanks again.

      If you have any questions in the future, please let me know.

  6. i’m stuck in fastboot oem unlock. it say that ‘flasing unlock is not allowed’.
    what should i do then?

  7. Hello sir, I am asking if when it unlock bootloader and install TWRP without root in stock Rom. Is it still safe to get the OTA update? in MI A2 Pie latest build.

    1. Hi. No, you will not be able to install OTA updates. That’s because when you flash TWRP, you permanently modify the /boot partition of the device.

      So, to be able to update over OTA, make sure that you have not performed any modifications to the /system partition. Once you are sure of that, download the stock boot image for your build number and flash it using: fastboot flash boot filename.img

      After you have successfully restored the stock boot, TWRP will be removed and you shall be able to take OTA updates.

      The bootloader state (Locked or Unlocked) is not an impacting factor in this case, so you can stay out of worries.

    2. Thank bro, one question again. So, in terms of enable Cam2 API without root. The last thing to do is to re install stock boot via bootloader again?

    3. Hi. The method that I stated does not require you to restore the stock boot image. In the procedure, we actually temporarily boot the patched boot image. So, when you reboot the device after enabling Camera2 API, the patched boot image/Magisk root will automatically vanish.

Leave a Reply

Comments are moderated, and published only if they are relevant to the topic and add value in a constructive way. If you disagree with something, please be polite and respectful. We suggest you read our comment policy before commenting.