How to install Android Pie in Mi A1

Mi A1

Mi A1 is the Xiaomi’s first Android One smartphone. It has every box checked, including the dual camera with portrait mode. Google has uplladed Android Pie’s source code to AOSP last week after the roll-out of official updates for the Google Pixel/XL and the Google Pixel 2/XL. So Now the development community could now start its work on porting Android Pie.

XDA Dev team has the Android Pie ready for your Mi A1. Of course you can wait for the official updates, but if you want to explore it right now? Come on, Lets do it together.

Here are the screen shots of Android P running on Mi A1.

Click to Expand


  1. Make sure your battery is more than 65%
  2. Remove any lock screen security set up like finger print authorization or pass code.
  3. A PC and a standard USB cable.
  4. Install ADB and fastboot in your PC ( Here is the simple guide to install ADB and fastboot)


  • Download the TWRP installer in your Mi A1 smartphone or download in PC and move it to your device. Do not unzip this.

That is it. Keep the downloads ready and let us proceed to the installtion part.

Enable USB Debugging and OEM Unlocking

  • In your device, go to About phone and tap on Build number for few time. This will enable Developer options.
  • Go to settings–> developer option in your device and enable OEM unlocking and USB debugging. Below are the sample images where you can find both options.

OEM Unlock
USB Debugging

Unlocking bootloader

Press and hold Volume down and power button at the same time till fastboot screen appears on your device.

  • Now connect your phone to your PC with the standard usb cable and wait till the phone is detected
  • Go to the folder where Fast boot is installed.
  • Open command prompt and move to the directory where you installed ADB or press SHIFT key and right-click on an empty space inside the folder and Select ‘Open PowerShell window here’ from the right click menu that appears. If your PC running on windows 10 the option will “Open command window here”
  • A PowerShell window shall open on your PC.


  • Now type the below command in your command prompt.
  • Command
    fastboot devices
  • Now type the below command in the prompt to unlock your devices’s bootloader.
fastboot oem unlock
  • You can use below command to confirm whether you have unlocekd your bootloader successfully.
fastboot oem device-info

If you see true for “device unlocked” row in the command prompt , then congratulations you’ve successfully unlocked your bootloader :)

Installing TWRP Recovery

As discussed in the Downloads section,

  • Download the TWRP recovery file(Click to download) for Mi A1 in your PC
  • Extract the TWRP file and move it to the folder where you’ve extracted ADB and fastboot files and rename the file as twrp.img for easier access.

Now use the below command to install twrp recovery in your Mi A1 Smartphone

fastboot boot twrp.img

This will start installing TWRP recovery in your MI A1 and your phone will boot into TWRP recovery

Installing TWRP Installer

As mentioned in the downloads section

  • Download the TWRP installer in your Mi A1 smartphone or download in PC and move it to your device . Do not unzip this.
  • Now in the TWRP recovery screen , Click Install , Browse snd select the TWRP installer and swipe to conform Flash . (Below is a sample image for reference)

This will permanently install TWRP recovery in your Mi A1. Once flashed,

Factory reseeting Data

Step 1: Click on Home button to go back to TWRP recovery

Step 2 : Tap on Reboot and click Recovery in the next window to reboot back into recovery

Reboot back into recovery
  • Now your device will boot back into recovery mode. Tap on “Wipe” , select format data and Swipe to confirm. Type yes in the next confirmation screen
Formatting data

This will start formatting data. If you see any errors, Repeat the same steps from Step 1. The next time you will not see any errors and your data will be formatted.

Add Treble Support

Now the next step us adding Treble support to our Mi A1. Follow the below process carefully. first step is Repartitioning your Mi A1


  • Tap on “Tissot Manager” in your TWRP home screen
  • Check ” I undetstand box” and Tap on Next button

  • Select “RePartition-> Shrink User Data -> Single Boot and select “Repartition in the final screen.

This will start Repartitioning your device. Once the process overed, Tap on “Reboot TWRP”, This will again reboot your device into TWRP mode.

In case if your device is not shown in the PC, Tap on Mount in the recovery home page and make sure Data is Checked and “MTB” is enabled (You’ll see Disable MTB button if MTB is enabled”.

Installing Android P

As discussed in the Downloads section, download Android P image file A/B system Pie PR1 img in your PCand extract in the same placed where you have placed twrp.img

Now move all the below files to your Phone

Install Vendor Image

  • Now Tap on “Install” in TWRP recovery
  • Click on “Install image
  • Select the Vendor.img file from the list, then Select Vendor image partiton radio button and Swipe to confirm flash
Installing Vendor image
  • Ignore any errors if shown while installing.
  • After flashing completed, click on Home button to go to Recovery home screen, Tap on “Mount” and Select “Vendor image” and click “Select Storage

Install System image

Install system image similar to installing vendor image.

  • Now Tap on “Install” in TWRP recovery
  • Click on “Install image
  • Select the system image which we file from the list, then Select system image partiton radio button and Swipe to confirm flash

  • Now click on Home button to go back to TWRP Recovery , select POST-sGSI file_1 and swipe to confirm flash
  • Once POST-sGSI 1 file is flashed, press back button and select the another POST-sGSI 2 file and swipe to confirm flash.
  • Once POST-sGSI 2 file is flashed, press back button and select the kernel file and swipe to confirm flash.

  • Go to TWRP Recovery home screen Click on Install , Select Magisk file and Swipe to confirm flash
  • Once done, Click Back to go to TWRP home screen, Click on Advanced and Tap on “Tissot Manager” 
  • Select “Patches” and then tap on “SELinux mode”.  Once the process completes, Click on “Reboot to Recovery“. Now your device will be rebooted to Recovery mode
  • Finally, Tap “Reboot” and then “Reboot to System”.

This will boot your Mi A1 on Android Pie. Your device may reboot coupe of times and First boot will take some time complete which is perfectly fine.

That is it! Your device will now run on Android Pie.

Now update your Google Play services app and you can restore apps via Google Backup.



Media Transfer might be disabled by default.

To enable USB MTP

  • Enable developer options just like we seen here and Then look for the File Transfer option in the Developer options

Fix Stock Camera

To fix Stock Camera, just install this Magisk module(Click to download)

via TWRP to fix the Camera Settings crash issue. This includes the Mi A2’s stock Cam.

Check here on how to install Magisk Module


  • To enable Nav Bar, install this nav bar enabler(Click to download)
  •  Magisk. Check here on how to install Magisk Module
  • After rebooting, go to Settings > System > Gesture and enable Swipe Up on Home Button to enable the Nav Bar Gestures.


  • Install this Magisk module(Click to download)  to fix the Gcam Settings force close.Check here on how to install Magisk Module
  • Click here to download Gcam for Mi A1.


How to install Magisk module

  • Download and install the latest version of Magisk Manager apk from here in your Mi A1 smartphone.
  • Tap on “Tap to start Safety Net Check“, it should work fine.
  • Finally , Click on the Menu (Three line in to left)-> Add Modules -> Browse and select the dowbloaded Module.

This will install the downloaded Magisk module.

Video Guide