How to Enable Camera2 API on Xiaomi Mi A1 without Permanently Rooting it

Enable Camera2 API on Xiaomi Mi A1 running Android Pie without Root

Android Pie update for Xiaomi Mi A1 was released a while back and our users have asked us if they can enable Camera2 API on their Mi A1 after on Android Pie. To answer the question, I will show you in this post how to easily enable Camera2 API on Xiaomi Mi A1 without permanently rooting it. The instructions will work regardless of the Android version installed on your phone. Furthermore, links have also been provided below to download the latest Google Camera Port for your Xiaomi Mi A1.


The Xiaomi Mi A1 is the company’s first smartphone featuring the Android One program. Being a part of the program means that the device offers guaranteed updates. Be it a major Android version release or monthly security patches. Talking about the software, the phone incorporates the stock AOSP firmware which is free from the majority of OEM bloatware. If you try installing the Google Camera Port on your Mi A1, you will probably fail due to the lack of Camera2 API support. Despite being based on stock Android, the Mi A1 still doesn’t offer direct support for Camera2API on Android Pie or Oreo.

If you have rooted your Mi A1, you can easily enable the API by making a few build.prop edits or via a Magisk module. In the case of the former, you would mount and write the /system partition, which will ultimately break the possibility of installing OTA updates on your rooted phone via Magisk. So, if you do not want to root, you can still enable camera2 API on your Xiaomi Mi A1 quite easily.

The process that has been listed below will first require you to boot Magisk Patched Boot Image to temporarily root your phone. Once your Mi A1 boots into the OS, you can simply use a Terminal Emulator to enable Camera2 API by executing a few simple commands. Since you will be rooting the phone temporarily, you will still be able to take OTA updates after following this method, so stay out of worries.

Also read: How to Hard Reset Xiaomi Mi A1 to Factory Settings (2 Methods)

Table of Contents


Below are the download links for stock and patched boot images for Xiaomi Mi A1 running Android Pie. We have also provided the stock boot image for the corresponding firmware. It shall help you unroot your phone in case you mistakenly flash the patched boot permanently.


V10.0.24.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.23.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.22.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.21.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.20.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.19.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.18.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.17.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.16.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.15.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.14.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.13.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.12.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.11.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.10.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.9.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.8.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.5.0.PDHMIXM Stock Boot Image Patched Boot Image
V10.0.4.0.PDHMIXM Stock Boot Image Patched Boot Image

Instructions to Enable Camera2API on Xiaomi Mi A1

In order to temporarily boot the patched boot image on your Mi A1, you must first install Android platform-tools on your PC and unlock the bootloader of your Xiaomi Mi A1 (Note: Unlocking the bootloader will wipe all the data on your phone, so make sure that you take a complete backup first). If you already have the bootloader unlocked, nothing will be wiped using this method.

I have personally tested this method on a Xiaomi Mi A1 running the latest Android Pie firmware. Although, it will work on older Android versions too. Just make sure that you download the patched boot image corresponding to the software build number installed on your phone.

Now to enable Camera2 API on your Xiaomi Mi A1, follow the instructions below.

  1. Download the Magisk patched boot image for Xiaomi Mi A1.
  2. Copy the downloaded image file to the folder where the ADB/Fastboot binaries are present (e.g. C:/username/platform-tools).
  3. Hold the SHIFT key and right-click on an empty space inside the folder.
  4. Select the ‘Open PowerShell window here’ option.
  5. Power off your Xiaomi Mi A1 completely.
  6. Now hold the Volume Down and Power buttons together to enter Fastboot Mode.
    Enable Camera2 API on Xiaomi Mi A1 - Boot into Fastboot Mode
    Fastboot Mode on Xiaomi Mi A1
  7. Connect your phone to the PC using the USB cable.
  8. Enter the following command to temporarily boot the Magisk patched boot image on your Mi A1:
    fastboot boot boot-image-filename.img
  9. Make sure to replace ‘boot-image-filename.img‘ with the actual filename. For example, if you’re on the firmware with V10.0.21.0 build number, the command should be:
    fastboot boot patched_boot_V10.0.21.0_mi_a1.img
    Enable Camera2 API on Xiaomi Mi A1 - Temporarily Boot Patched Boot Image
  10. Just as the command is entered, your Mi A1 should boot into the OS with temporary root with Magisk.
  11. Right now, only the Magisk Manager stub is installed on your phone. In order for Magisk to work and to grant superuser permissions, you must first install full Magisk Manager.
  12. Simply go to the phone’s app drawer and launch Magisk Manager app (In case the app doesn’t show up, download the latest APK from here and install it on your phone).
  13. Select “Yes” when prompted to upgrade to full Magisk Magisk Manager and follow the on-screen instructions.
    Upgrade to Full Magisk Manager on your Xiaomi Mi A1 when prompted
  14. Once Magisk Manager is fully installed, download and install Termux (Terminal Emulator for Android) on your Mi A1.
  15. Once installed, launch Termux and enter the following command:
  16. Grant superuser permissions to the Termux app when prompted.
  17. Finally, enable Camera2 API on Xiaomi Mi A1 running Android Pie by entering the following commands:
    setprop 1
    setprop 1
    setprop 5
    setprop 5
  18. Further, enter the following command to enable EIS (Electronic Image Stabilization) on Mi A1:
    setprop 1

    Enable Camera2 API on Xiaomi Mi A1 - Enter Command in Terminal Emulator

  19. Once the command executes without any errors, close Termux and reboot your phone. When your phone reboots, Magisk Manager should vanish and your Mi A1 should be unrooted.

For further confirmation, you can also check Camera2 API support using an app. With the API enabled, you can now go ahead and install Google Camera Port on your Mi A1.

Download Google Camera Port for Xiaomi Mi A1

XDA RD joeyhuab created a dedicated thread on the forums to share the latest working Google Camera Ports for Xiaomi Mi A1. Below are some of the GCam ports shared by different users on that thread. Note that each version may have bugs of there own. Rest assured, these are the most stable ports available for the device as confirmed by the XDA users who shared them.

Note: For Wyroczen’s version, you will need to install the DotFix module on your rooted device. If your Mi A1 isn’t rooted, then go to Google Camera app “Settings” > “Advanced” > “Lab” and disable “mi a1 dot related fixes”. Also, switch “raw_sensor” to “raw10”. This shall help prevent pink/purple tinted photos.

If you’re not satisfied with the provided ports, you can try and find the perfect one for you from here. Finding the perfect GCam Port for any device is hard. If you have found a better port, then please let us know in the comments. It would help other users who are looking for it.

You have just succeeded to enable Camera2 API on your Xiaomi Mi A1 without root. If you have any questions regarding the method listed above, please feel free to leave a comment.


  1. Hmmm…. I enabled it, accoring to this and checked the status with an app, which was fine.

    But still I can’t use an external camera.


    1. You mean you’re trying to use a physical camera (like a webcam) externally?

  2. Hi, thanks for the VERY informative tutorial. Just a couple of doubts: how do we know if we have flashed the root version permanently? And as you have already uploaded the stock boot images, how do you flash that if we have mistakenly flashed the patched version permanently? (I’m asking this because I want to be completely safe in this method and also I’m a TOTAL newbie in these things and this is my first ever venture, and it’s very scary, not knowing what might happen at an time.)

    1. Thank you Navneeth for the kind words.

      The quickest way to differentiate between a permanent flash and a temporary boot is the command itself.

      In this tutorial, we are using the ‘fastboot boot’ command, which basically just boots the phone with the directed partition image (a patched boot image in this case).

      On the other hand, when you “flash” something, the command uses the ‘fastboot flash’ syntax. For example, if you were to flash the patched boot image, the command would be: fastboot flash boot boot.img (Here ‘boot.img’ would be the actual filename of the boot image).

      TL;DR – As long as you use the ‘fastboot boot’ command as instructed, your phone will automatically be unrooted on the next reboot.

  3. Hi Dhananjay,
    When can we expect patched boot image of V10.0.24.0.PDHMIXM.

    Thanks in advance

    1. Yes, Kapil. I have added it now, please refresh the page and check.

  4. Hi! Do I need the patched version of the V10.0.24.0.PDHMIXM in order to follow the process? It seems that the patched version is not available yet..


    1. Yes, you will need the patched boot image for V10.0.24.0. I am in midst of extracting, patching and uploading it. Just hold on for a while.

    2. Hi;
      I need the patched boot image for V10.0.24.0. Will you share it sir?
      thank you

  5. Hi could you add patched boot image V10.0.24, I changed my mother board so Camera2api got disabled. It would be helpful if add the file on your blog before December

    1. Charan, I have added the latest stock and patched boot images for the V10.0.24.0 update.

  6. Hello!

    I am not trying to enable Camera2api, but solving an issue with the volume of the speaker during calls, it is really low.
    I need to edit “root”\system_root\system\vendor\etc\mixer_paths_m tp_global.xml”.

    Will this way work for this and make it permanent?


    1. Yes, it will work. But when you unroot (i.e. reboot the phone), it might end up in a bootloop because the /system partition was modified.

      If performing the fix is really something you need to do, then I suggest you root the phone.

  7. hello Dhananjay
    Would you have this version? V10.0.24.0. Patched Boot Image
    My Xiaomi is in that version 🙁
    Thank you very much for the excellent tutorial!

  8. Hi Dhananjay,
    thank you for this post – it saved my (phone’s) life a few times.
    Any chance you could add the newest boot image V10.0.24 (from the August update)?
    I tried to extract it from ROM with Twrp and failed miserably…

    1. Tobias, I have added the stock boot for the August 2020 update with V10.0.24.0.PDHMIXM build number.

    2. Hi Dhananjay, where can I find the patched boot image for august 2020 update (V10.0.24.0) ?

  9. Hi what do I need to do the img files are in a zip and if I click them it says they are corrupted.

    1. Hi. You have to extract the .img file from the downloaded zip and use it with the instructions. You do not have to open or extract the .img.

  10. hi Dhananjay,

    if you install some modules during the process when the mobile is rooted, once unrooted and updated by OTA, will you loose the modules previously installed?


    1. Yes, you will. When Magisk is uninstalled, it takes away the modules to ensure that they don’t cause any problems with the unrooted system.

    1. Hi Gaurav. Stock and Patched boot images for the July update (V10.0.23.0) have been added. Please check now.

  11. Hello Dhananjay, by following steps 1 to 13, can I install magisk manager in my phone ? If so, should I use stock boot image instead of patched ?

    1. Hi Nithin. Do you mean you want to install Magisk and root your Mi A2 device?

    1. Hi Helvin. I haven’t been able to capture the OTA URL or get a direct link to the full ROM/fastboot.

      Though I have found something. I am currently downloading it and will reply back if I add the boot images.

    2. Hi again, Helvin. I have just added the boot images for June security update.

    1. Hi Ali. For now, I do not have my hands on the OTA package of the June 2020 update. As soon as I do, I will extract the boot image and upload it.

    2. Hi Ali. If you still need it, I have just uploaded and added the V10.0.22.0 boot images to the post.

  12. hai, i just follow your tutorial carefully. but, everytime i open google cam its always crashes. help me, please

    1. Hi Lanang. Have you tried installing a different port? If all the ports crash, it means that camera2 API wasn’t successfully enabled. To confirm the same, please check this post.

  13. Does the phone have to be rooted first?
    or have to install the magisk manager first?
    Please help

    1. Hi Nanda. Yes, the phone will have root permissions, but only temporarily. Since you will only temporarily boot the phone with the patched (rooted) boot image, it will only stay rooted until the next reboot, as mentioned in the instructions.

  14. hi, thank you for this tutorial.
    it works well on my phone,

    can you please update the latest patched boot image (March Security Update) please?

    1. Hi Chaki. I have added the download links for the stock and patched boot images for the March 2020 security update. Please refresh the page and check again.

    1. Hi Asif, both the patched and stock boot images for the March 2020 update have been added.

  15. hi, thank you for this tutorial.
    it works well on my phone,

    can you please update the latest patched boot image (February Security Update) please?

    1. Hi Hadi. I have just added them, along with a couple of new ports from various developers like marlin-ku and overwhelmer.

    2. hi, thanks for the file, it really work on my cousin’s mia1, now he can easily install any gcam version out there, haha

      god bless you!

  16. Será que já saiu p patch de janeiro para o MiA1?

    desde já, obrigado!

    Has it already left the January patch for MiA1?

    thanks in advance!

    1. Hi CasaLiro. I have added the patched and stock boot images for the January 2020 update. Please refresh the page and check again.

    1. Hi Ikhsan, if your phone’s bootloader is already unlocked, then no, this process will not wipe any data stored on the phone.

  17. Hai how lock oem back. I try to oem lock in fastboot but the device become error system has destroy

    1. Hi Nizar. Do not lock back the bootloader without undoing the camera2 API commands first. The error message you mentioned arises due to modifications detected on the device by the bootloader.

      Plus, once you update your phone to newer software, you will need to re-enable camera2 API. Which means you will need to unlock the bootloader again. So, it’s best to keep it unlocked.

  18. Bro thanks i could not found a single thread about installing (Pie Dec 19) Gcam for Mi A1 including XDA and may be its because of the Mi A1 is getting old and developers have switched to another device.
    But anyhow ton of thanks as i installed successfully Gcam with temporary root having no issue in instillation process , i am on pie December security update and now having camera2api enabled in my Mi A1.

    Thanks and keep it up.

    1. Hi Ibrar. Thank you so much for your appreciation. It means a lot to me.

  19. Hello
    I just got the December 2019 Update (1st dec.) but I don’t find any patched boot.img for it.
    Do you have it and could you upload it and update the site?
    Thank you very much.

  20. Hi Dhananjay. The magisk app stays installed in my phone after reboot. Does that mean my phone is permanently root?

    1. Hi Afnan. Once you have rebooted the phone, go to Magisk Manager and it should show that Magisk is not installed. This means your phone is not rooted, and you can remove Magisk Manager safely.

  21. Thank you so much!
    The re-Locking the bootloader (with the volume – method) works also!

    1. Hi! When I type in “fastboot boot boot-image-filename.img” it says no such file in directory. What do I do?

    2. Hi Allan. You need to replace “boot-image-filename.img” with the actual filename of the patched boot image.

      For example, if you’re using the November patched boot image, the command should be:
      .\fastboot boot patched_boot_10.0.15.0_mi_a1.img

      I hope it clarifies.

  22. hello how can I do it if my security patch is November 1, 2019

    Which patched boot images to select ?.
    it’s a mi a1

    thanks for your help.

    1. Hi Cristian. I have uploaded the November 2019 stock and patched boot images. Please check now.

    2. Hey bro i used latest November security patched boot image… everything ok but when I reboot my phone magisk says magisk not install I have to fastboot the image file after reboot pleas help

    3. Hi Khabir. By using this method, your phone is only temporarily rooted, until you reboot. A reboot will unroot your phone.

      After booting with the corresponding patched boot image, you will need to use Termux to execute the above-stated commands.

  23. hello,
    my self jignesh
    is Android Pie patched boot images and Magisk Patched Boot Image both are the same file not. if not advise me link from where I can download Magisk Patched Boot Image for my MiA1 with October 2019 update

    1. hi
      I have done it. it’s working nice.
      thanks for your post.
      the only thing I need to confirm is magisk Manager is still on my phone after rebooting. I should remove it or not

    2. Hi Jignesh. Please, open Magisk Manager, it should show that Magisk is not installed. If so, then you can safely remove the app.

      P.S. Thanks for your appreciation. I am glad it was helpful to you.

  24. Hi Dhananjay! The re-uploaded patched image for October 2019 works fine and I successfully enabled HAL3 & EIS. Thanks a ton 🙂

    1. Great! You’re welcome Shrnjay. And apologies for the previous boot images that caused the issues.

    2. Hi, thank you for guide
      Do you know if there is the rom patched of nomvember update?

  25. I wanna know after doing all of these above steps my bootloader is still unlocked, because there wasn’t any instruction given to lock the bootloader so should i lock it, or not? will it brick my phone or it’s safe to lock it?

    1. Hi Praneet. Yes, the bootloader will still be unlocked and it needs to be kept that way. If you lock the bootloader, the Camera2 API will be disabled. Locking is possible, and should not brick your phone. But if you want Camera2 API, you must keep it unlocked. And don’t worry, neither an unlocked bootloader or the Camera2 API modifications will prevent you from taking and installing OTA updates on your phone.

    2. @Dhananjay, you are wrong. I have enabled Camera 2 API then I locked bootloader without losing any data and using Gcam after locking the bootloader.

    3. Hi Samuel. Thanks for correcting me. I don’t own the device anymore, but the same unlocking trick (without wiping user data) stopped working for the Mi A1 months ago.

      Even if it works, I wouldn’t suggest locking the bootloader. That’s because once you update your phone with a future security patch, you will need to re-perform the procedure to enable Camera2 API. For which, you will again need to unlock the phone’s bootloader.

      I personally find it quite redundant, following the whole unlocking, enabling camera2 API, and re-locking bootloader again, and again, every month.

      Unless someone is skeptical about their device’s security with an unlocked bootloader

    1. Hi Ayrton. First of all, your Mi A1 should be running Android 10 to be able to use the Pixel 4 camera port (Google Camera 7.0 or above).

      Try downloading the first two ports available here. One is of Google Camera v7.0.009, while the other is of v7.1.019. Give them both a try and see which works the best for you. For the v7.0.009 port, you will also need to load the config file, which could be found here.

      Also, do let us know which version works best so that we can update the post with the link to that version as well.

    1. Hi, Pieter. The October patched boot images are now available for both the Mi A2 and A2 Lite.

    2. Yes, Uzair. It should work. Earlier this guide used to use the same tool, however, I decided to update it to use this method.

      That’s because it works on any Windows, Linux, macOS PC. On the other hand, the tool can only be used on Windows. Plus, using this method, you get a proper insight into what is actually happening. So, if anything goes wrong, you’d know where it did and you can fix it easily.

    3. the thing is this tool doesnot root the magisk or twrp .. it just loads the recovery.img file and then restarts the phone thats it . I dont think it will work without root magisk and twrp

    4. Yes, I remember now. The tool is supposed to temporarily boot your phone into TWRP to perform the required procedure. I think it’s better for you to follow the current method instead. By doing so, you will also learn more about how things work.

    5. Hi Dhananjay, good to hear the support for Mi A2 series is going strong.

      But is there any chance of uploading the one for Mi A1 as well?


    6. Hi Pieter. Yes, they have been uploaded as well. Please refresh the page again in case it’s not appearing for you.

    7. BTW, could you please try the patched boot image and see if it works without any issues? (Patched using Magisk v20.0)

    8. Unfortunately it doesn’t work for me.
      When booting the patched boot image (using “fastboot boot patched_boot…”), the phone just reboots into the normal OS, without root and without Magisk Manager.
      Note that bootloader is unlocked and USB debugging active.

      Is it possible to check and let me know what I should do?

    9. Hi Pieter. After booting your phone with the “fastboot boot patched_boot_****.img” command, download the Magisk Manager APK from here and install it on the phone. Then launch Magisk Manager from app drawer and see if it shows that Magisk is installed or not.

    10. The problem is that it doesn’t boot the patched boot image. Instead, the command just makes the phone reboot into the normal OS.
      Then after installing and launching Magisk Manager (through the link you mentioned), it says that Magisk is not installed.
      Finally, the “su” command in Termux also doesn’t work.

      Maybe there is something wrong with the patched boot image?

    11. Hi Dhananjay! I booted October Mi A1 patched img and installed Magisk Manager, but it shows Magisk is not installed. What should I do?

    12. Hi Shrnjay. I have reuploaded the new images, and they have been confirmed to be working. Please try downloading it once again, and then use the “fastboot boot patched_boot_10.0.14.0_mi_a1.img” to temporarily boot your phone with Magisk root.

    13. Yes, I doubt the same now. I have re-uploaded the new images. Please give them a try and confirm.

    14. Hi Pieter, that’s great! Sorry for the inconvenience caused due to the previous ones.

    15. After august update,my Mi A1 Don’t connect with computer with fastboot serial.

    16. Hi Mahumud. Please connect your Mi A1 (in Fastboot mode) to the PC and check Control Panel > Device Manager to see if it is properly being detected.

      This seems more like a USB driver issue.

    1. Hi Aditya. There’s no specific fix for a version, until stated otherwise by the GCam developer himself. I am already compiling a generic list of all Google Camera 7.0/7.1 available.

      Until then, visit this page and check the list of last 30 GCam releases. Search the list of “7.1.015” and try the different GCam ports available.

      It’s all trial and error, you have test which works best for your device and Android version.

  26. Hi,

    My phone is unlocked but not rooted. I’d like to enable camera2 api and also install gcam. If I temporarily install magisk with the abovementioned steps, will all the data on my phone be wiped?

    1. Hi Serder. The only time the device is completely wiped off, is when unlocking the bootloader OR if you manually perform a factory reset.

      So, the answer is: No, you will not lose any data whilst using the the steps above to enable Camera2 API on your phone.

      However, I still strongly suggest that you take a full backup first. Not necessary, but recommended. I personally do it weekly, to ensure that if I ever manage to miss something and things go sideways, I will always be assured that my data is safe. Just an advise.

    1. Hi Sid. Since your phone is already rooted, you can directly follow on from step #14 and further to enable Camera2 API on your Mi A1.

  27. I was able to follow the tutorial until number 11.
    when I install termux it does not ask for user permission and therefore does not accept the commands “su” and “setprop 1”

    1. Hi Aryton. Once you executed the “fastboot boot” command to temporarily boot the patched boot image, do you see Magisk Manager installed in the app drawer?

  28. I want September 2019 patch boot img which remains the root & magisk manager after reboot. If you have such patch boot img please share with me.

    1. Hi Jaypal. Which command did you use for the patched boot image (September 2019)? Was it “fastboot boot” or “fastboot flash”?

  29. Hi, I have used this steps since I upgraded my mia1 to android 9 and I so grateful for you! Now I need to re-install… Can you pls post the september image? THANKS A LOT <3

    1. Hi. Thanks for the kind comment. The image is now available for download.

    1. Hi Aryton. I don’t think it’s anywhere we used ADB during the whole process. Exactly when did you see this error? During which step?

    2. in part 9, later I was able to install the IMAGE of August by CMD, but after that I was not rooted my device and termux didn’t ask for superuser permission

  30. Hi, Can you please upload patched image for the September 2019 update?
    I would be very grateful.
    Thanks in advance.

    1. Hi Parag. Once I get hands on the full OTA package or fastboot image of the September update, I will surely upload and post the boot images as soon as possible.

  31. Hey! Followed the tutorial and GCam is working fine! Thanks.
    Now, 2 questions? Everytime I turn on the phone it says the boot is not locked, is this normal?
    Can I uninstall magisk now after Im done?


    1. Hi Daniel. I am glad it worked for you.
      As for your questions:
      1) Yes, that warning is normal. You can ignore it and it also wouldn’t prevent you from taking OTA updates.
      2) The idea behind using this method is that your phone is never permanently rooted. It is only rooted temporarily, and root will be removed once you reboot your phone after completing the procedure.

      One more thing, do let us know which version of the port works best for you and does it have any existing bugs?

      Also, if you’re using a different port than the ones available above, share that with us so that other readers can benefit from it too.

  32. I think the download link for boot image (august 2019) is broken. It’s constantly generate a new download key but it never does. Anyone helps?

    1. Hi Strider. I have personally tried opening the download link on both mobile and desktop, it works fine on my end.

      Please try using desktop, if you currently tried via mobile, or vice-versa.

      If it still doesn’t work, let me know, I will provide you with a mirror link to download the file.

    2. Hi Strider. Must be some issue with Mediafire. Please try these links if you’re still on the August 2019 update. On the other hand, Patched and Stock boot images for consecutive September and October updates are now live.

    3. I tried now the stock boot image August 2019 and doesn’t work both on mobile and desktop, could you please provide a mirror link to download it?
      Many thanks


    4. Hi Marco. Please check the download links here, provided by XDA member paolocorpo. Make sure that you replace the filename while executing the “fastboot boot” command.

    5. I successfully completed this method…
      Bt one question is now September update release.
      And i want to install September update without any issue?
      Bootloader unlock

    6. Hi Jakaria. Since this method doesn’t root your device permanently, you can easily install the September OTA update. The bootloader status (unlocked) doesn’t affect the ability to take OTA updates.

      Once updated, you will need to repeat the process using the Patched Boot Image file of the September update to re-enable Camera2 API.

  33. Hi Dhananjay,

    I didn’t get pop up for superuser permission in Termux app. And if i direct enter su command it says permission denied. Do we need TWRP or something else? Please help.

    1. Hi Ajay. Once you boot your phone with the patched boot image, open Magisk Manager, tap on the menu icon, and select ‘Superuser’. See if Termux is being denied permissions over there.

  34. Please make video or write..
    How to install gcam August update mi a1..
    And bootloader unlocked…i get OTA update for any issue??

    1. Hi. You will first need to enable camera2 api using this method. Once enabled, you can download the latest GCam port from the bottom of the post and install it.

      You will need to keep your bootloader unlocked for this. However, that won’t create any problems with OTA updates.

      OTA updates will only be a problem when you permanently root your phone. This method only temporarily roots your phone and it is removed once you reboot your phone after enabling camera2 api.

  35. Hi! I followed your instructions and I’m stuck at su where it won`t give me access. What should I do to get it done?

  36. I installed gcam using this method in android 9 july update. My bootloader is unlocked now. Will I able to get OTA updates continuously?

    1. Hi Sam. If you follow this method, then yes, you will be able to install OTA updates, since the phone was never permanently rooted or any sort of modification was made to any partition.

    2. Hi, could you upload the new patched boot image? I’ve received the August security update. Thanks.

    3. Hi Vincenzo, the patched boot for August update is now available.

  37. Hi,
    I lost imei no. after following above in july updated pie.

    i corrected the imei by WriteDualIMEI(W+G_eMMC).exe.

    but still no network ,pls help.

    1. Hi Sarabjit. The instructions above can, in no way affect the phone’s IMEI or any other modem info for that matter. I can vouch for that.

      Anyhow, the important part now is to how you can restore it. I recommend that you follow the instructions in this thread to recover the lost IMEI on your Mi A1.

  38. Hi,

    I did the process, but I have an strange issue.

    My WiFi are not working, it is just impossible to turn on.

    Do you know what can I do to fix it?

    I’m on July 2019 security patch.

    Thank you

    1. Hi Mahesh. For two major reasons:
      1) If a user accidentally flashes the patched boot image instead of temporarily booting it.
      2) In case a user faces an issue while installing the OTA updates.

  39. Hi Bro,

    I successfully installed G-cam as your guide but I has got boot-loop error when I made re-lock boot-loader and can not get OTA July 19 update. Pls. help me to fix this problem.


    1. Hi. Please DO NOT re-lock the bootloader if you want to use this method. Keeping it locked will still enable you to take OTA updates.

  40. Dear Dhanajay,
    the file name of download IMG file is ‘patched_boot_10.0.10.0_mi_a1’. Should this be changed to ‘patched_boot_V10.0.10.0.PDHMIXM’ to carry out the above procedure.
    Please advise.

    1. Hi Kanchan. The filename does not matter. I renamed it as such to make sure that they are clearly identifiable. You can simply rename it to “boot.img” and use the command ‘fastboot boot boot.img’. Hope this clears out.

  41. Dear Dhanajay,

    I have already updated to pie june2019 update. Is the above procedure described by you still applicable. The build no. PKQ1.180917.001.V10.0.10.0.PDHMIXM.
    How the patched boot IMG file is to be renamed. Please advise.

    1. Hi. Yes, it will surely work. Just download the patched boot image for V10.0.10.0 from above and follow the given instructions.

    2. Simply execute this command (setprop in addition to the rest of the commands mentioned above.

    3. I am cannot install Magisk via Magisk Manager and i am cannot access su under Termux Apps. How to fix it?


    4. Hi. Which software version is installed on the phone? And which patched boot image file did you download and use?

    1. Hi Sid. If you already have root access, install Termux and follow the steps thereafter as stated in the list of the instructions above.

    2. podrias ayudarme? tambien tengo acceso root le e dado permisos de root a termux introduzco los comandos uno tras otro sin que me arroje ningun error y aun asi no se desbloquea la camera2api. Tengo el parche de abril y la ultima version de magisk funcionando :c Gracias

    3. Hi Edward. After executing the commands, reboot your phone, then simply download the latest GCam Port for your Mi A1 from above and install it. Once installed, try running the app and see if it’s functional. If it works, it means that the API has been enabled.

    1. Hi Zack. The May Patched Boot is now available. And never use a patched/stock boot of another software version.

  42. Cant get temporary root, i following ur step correctly and many times.

    – i patch boot image
    (Phone boot to os)
    no see any magisk manager in app drawer so install it manually
    – i open termux execute “su” command on cmd nothing happen (not get superuser permission) then i try type in the termux (same)

    – i cant continue the step coz not get temporary root

    I just wondering, every time after patch boot and try open magisk manager there no additional setup & directly install option like the video just download zip & select patch 😂

    1. Hi John. After booting with the patched boot image, install Magisk Manager, then go to the Magisk Manager settings and set the “Update Channel” to “Stable”. Once that is done, retry the procedure.

  43. Hi there could you please upload boot image may 2019?

    I just update v10.0.9.0 PDHMIXM

    I want to install gcam with this method and that current update, its okay?

    My device is no root and i got PC win 7.

    Thanks you for your attention, i really appreciate it 🙂

    1. Hi John. The May 2019 patched boot is now available. Yes, just use the provided patched boot and you should be able to install GCam port easily using this method.

  44. Could you please upload the mau patch?

    I has finish adb using 15 second adb instaler

    Question is, its fine to following the next step to enable camera2 api using this method? Coz ur method “adb devices” always facing problem.

    1. Hi. I have uploaded it now. If ADB devices command is not detecting your phone, then it’s probably a USB driver issue. What happens when you enter the “adb devices” command in the PowerShell?

  45. I have some questions. When can i get the may patched boot img ? Can i apply next month’s security updates without the worry of bricking my device ? If i did this and updated to the next month’s security update will i have to do the same process again with the new patched boot img ? Can i relock the bootlaoder after the process without the worry of bricking it or do i have to keep it unlocked ? And lastly how can i undo the process if i dont want it after sometimes.

    1. Hi Casper. Below, I have tried and answer all your questions to the best of my knowledge:
      1) May 2019 patched boot image is now available. Check the Downloads section.
      2) Yes, you can apply OTAs after using this method without issues.
      3) Yes, you will need to re-apply the procedure with the patched boot image of the following update that you installed.
      4) I’d recommend not to re-lock the bootloader. Stay unlocked, because you will need to apply the same process after next month’s OTA update.
      5) You can undo by simply restoring the stock boot image corresponding to the software version installed on your phone.

      I hope that will suffice. If you have any further questions, please feel free to reach back out via the comments.

  46. Hi, some details:

    “We have also provided the stock boot image for the corresponding firmware. It shall help you unroot your phone in case you mistakenly flash the patched boot permanently. ”

    For Abril 2019 update, both Patched and Stock links point to same file (patched)

    “ (By Ezequiel Kohan): ”

    The link seems to be dead. Error 404.

    Thank you.

    1. Hi Pepe. Thanks for notifying, I have updated the links to the correct files.

      As for the GCam port APK, the one was provided from XDA. The link is now dead, so I have removed it. But, I have also added a new port to the list, which will also not need any config files.

  47. Relock Bootloader problem
    I’ve a problem with the relock bootloader processing.

    When the Gcam is already installed, I try to lock the bootloader, but after restart the phone from “fastboot reboot” appear this message” the system has been destroyed”.
    Is there any possiblity to relock the bootloader and conserve the Gcam?

    I press “volume down” when i lock the bootloader, and I change the patched image with the original but the results is the same.

    Will be great that someone can help me or explain me where is the mistake.

    1. Hi. Kindly unlock the bootloader again and let me know if the warning goes away.

      Take a backup of all your data first, including the internal storage. Unlocking the bootloader will completely erase all the data.

    2. the problem is only when i would lock the bootloader, after the unrooting.

    3. Hi again. In that case, you should keep it unlocked. When the bootloader is locked, it analyzes that the OS has been modified in some manner, and thus you see the warning.

  48. Hello I am having a problem using the Termux app I have patch the file V10.0.8.0 (April 2019) the termux app is not asking superuser request and after some time it shows Permission Denied plzz help me how to give the app permission without a popup msg.
    and even root checker us also not showing any root access plzz rply and help..


    1. Hello Akash, after you boot your Mi A1 with the Patched Boot Image, do you see Magisk Manager in the app drawer? If not, then download it from here and install it. Once it is installed, go to the app drawer and launch it.

      Magisk Manager should show that Magisk is installed on the device. After that, you can go to Termux and execute the commands.

      Note that you have to do this all while the phone is booted with the patched boot image. Once you reboot, root will be gone.

    2. After booting the patchboot image there is Magisk Manager in the app drawer when i open magisk manager, it shows install magisk manager. Should i install it manually??
      because in other method i have rooted my phone using magisk manager but when I uninstall the magisk manager the system reboots and its stucks on mi logo.

    3. Hi Akash. No, you don’t have to install it manually. When you boot your phone with the Patched Boot Image, Magisk is automatically installed.

      Once booted with the patched boot image, please go to Magisk Manager > Settings > and set the “Update channel” to “Beta”. Then force-close the Magisk Manager and relaunch it. See if then it shows that Magisk is installed or not.

      Let me know how it goes.

    4. I am glad it did. I would have mistakenly patched the boot image with the Beta version of Magisk. Hence, abnormality. Enjoy GCam now!

  49. Hello ,thank you very much for your help. For doing all of this procedure , I have to unlock oem?

    1. It could be done easily. Simply boot your phone into Fastboot Mode, then connect it to the PC, and issue the “fastboo oem unlock” command in the CMD/PowerShell window.

  50. can yo please tell if the patched boot image for {Xiaomi Mi A1 V10.0.8.0 (April 2019)}is working because when i pasted it in platform tools and executed it say no such file is found.

  51. PS C:\adb> fastboot boot patched_boot_10.0.8.0_mi_a1.img
    downloading ‘boot.img’…
    OKAY [ 0.531s]
    FAILED (remote: unlock device to use this command)
    finished. total time: 0.562s

    i have this error

    1. Hi. You must first unlock the phone’s bootloader, in order to use this method. I apologize for not having mentioned that in the post earlier. I have done it now.

  52. Hi! First of all I wanted to thank you, I’ve been wanting to install GCam for months and now I have it, and it works flawlessly. I have a question though. Should I lock the bootloader again? Unfortunately unlocking the bootloader wiped all my data (factory reset) and now I can’t install the Netflix app.

    1. Hi. Yes, you can safely lock the bootloader again. As for the Netflix app, please clear the app data and re-install the app. See if it works then.

      I am saying this because I have Netflix on a few of my personal devices that have unlocked bootloader, and I have no problems running it.

  53. this worked, I tried patch april and it worked. but my advice is to edit the post, before going to the next step first to unlock the bootloader, then add the ‘adb shell su’ command in the command prompt after installing the boot patch

    1. Thanks for the confirmation, Taufiq. Either way is fine, you can use the adb shell in CMD/PowerShell or use the Terminal Emulator to do the job on-device.

  54. Hi there, i wanna ask something. First of all, I wanna say you’re amazing man. I try to follow your instruction and it went very well. My question is if I going to update my phone to April’s patch, do I have to repeat the steps again by using April patched boot to keep my camera2 api open? Thank you in advance!

    1. Hi Julio. Thank you for the kind words! Really appreciate it. Seeing such comments make my day and give a satisfaction that my tutorials are actually able to help people.

      Over to your question now. In majority of cases, the Camera2 API will still be enabled after updating. However, sometimes, the updates bring changes to certain files that may overwrite the commands we did during the procedure.

      In simpler words, once you have updated, try opening the Google Camera app and see if it works. If it doesn’t then you can always use the patched boot image of the updated version and re-perform the procedure. It should only take a couple of minutes to do it again.

      Hope that helps, let me know if you have any other questions.

    2. Hi there, sorry for very late reply. Thank you for answer my question. But now i’m facing another problem, i couldn’t install security update both april and may patch. Could you help me resolve this problem? It’s okay if you couldn’t anyway XD

    3. Sure. Let me know which software version do you have installed currently?

  55. I am going do this for the first time and tomorrow i have updated (april 1st), but,,
    Can i use Banking application after installation og GCam?

    1. Hi. Yes, of course, you can. The method only temporary roots your phone to enable Camera2 API. After executing the commands, when you reboot your phone, root will be gone. And thus, you can use any app that you want.

  56. Just updated today to April 2019 patch.
    Can i use the March patch version or should I wait for an April?

    1. Hi Murphey. Always use the Patched Boot of the software version installed on your phone. Since the full OTA zip of V10.0.8.0 update is now available, I have extracted it and patched it with Magisk 19.0. The link has been updated.

      Could you please try it and confirm that it works as intended?

  57. I was looking so hard for a functional march patched boot img! Please, continue updating the post with futures links for patched images and camera links. Thank you so much! <3

    1. Thank you so much for the kind words! I will make sure that download links are updated timely.

  58. Hello! When will the March Patched Boot be released? I just downloaded the march security update without knowing that there is no march patched update yet. Is there another way to install it having the march security update?

    1. march patched boot imgae doesnt work,when i in temporary patched image i try to enabled camera 2api and works,but when i reboot my phone i check in camera compability camera 2appi does not installed, help
      sorry for my bad english

    2. Hi Dimas. If the commands executed without problems, then camera2 API should have been enabled properly. Have you tried installing and running a GCam port on the device yet? If not, then please try once and see if it works.

    3. Hi again, I am glad it did! If you find a better GCam port in future, do let us know about it so that we can share the same with our users.

  59. – I am flashing the patched_boot_10.0.5.0_mi_a1 .img on the february security patch version (the device is oem unlocked), but it doesn’t give the su privileges . Tried 3 times and nothing!
    – I installed Magisk, I did not open it.
    – Restart telephone. Repeat the patch again e restart.
    – In adb folder, I executed the command:
    01 – adb shell su. In telephone appears shell root permission. Click em Grant
    02 – type enter e enter commands one line at a time
    setprop 1
    setprop 1
    setprop 1
    setprop 5
    setprop 5
    type enter again e reboot telephone
    – Install gcam e it works for a while.

  60. Not working. Magisk Manager wont install and have no idea how to do it manually. Dont have much time to google it… 🙁

    1. Hi. Once you have booted the Patched Boot Image via fastboot, download the Magisk Manager APK from here and install it. Then launch the app and see if it shows that Magisk is installed or not?

    1. Hi Daniel! Glad that it did work. If Magisk Manager was installed automatically upon booting the patched boot image, then simply rebooting your phone will un-root and remove the MM app too.

      But if you had to install it manually, then you will need to manually uninstall the app from Settings.

  61. Hi, thanks for the post. I am flashing the patched_boot_10.0.5.0_mi_a1 .img on the february security patch version (the device is oem unlocked), but it doesn’t give the su privileges . Does anyone else have the same problem ?

    1. Magisk Manager doesn’t appear in the drawer. I’ve allread tried to restart and repeat the procedure multiple times to no avail

    2. For anyone alse, having the same problem the solution may be rebooting the pc/adb client. After 2 days I’ve tried again and the procedure worked flawlessly

    3. Hi Michael. First off, I apologize for the late reply.

      In most cases, the PC-device connection is the problem, just like you said. At other times, you’d need to manually install Magisk Manager, that could work as well.

      I am glad you figured it out on your own. Cheers.

    4. I have rebooted my computer and make the fastboot boot image, but don’t have superuser privileges yet, do you have any other recommendation? I don’t want to install permanently the Magisk.


    5. Nor rebooting the PC, neither installing Magisc Manager manually, did the su command to work.

      What else can I do?

    6. Michael Michael I have the same problem, by putting the code ‘su’ says ”permission denied”, I rebooted the pc and it still does not work

    7. Hi. Are you sure that you tried installing Magisk Manager after booting your phone with the patched boot image?

      Once you reboot your phone, it will lose root (Because we temporarily rooted it).

    8. i’ve same problem. I use patched for Xiaomi Mi A1 V10.0.8.0 (April 2019). anyone solved this problem?

  62. Hi,

    May I know the exact dates of releasing the patched_boot image for February security update to my Mi a1? For Google camera purposes. Thank you.

    1. Hi Redney! After seeing your comment, I patched the stock boot image taken from XDA via Magisk 18.1 The link to it has been updated in the post. Please check now.

    2. Hi Mr. Dhana,

      Upon installing gcam. Force close was encountered, would you give me a solution for it? Thank you.

    1. Hi. I am sorry, but we do not do videos yet. We shall start doing it soon, but not just yet.

      You will first need to unlock the phone’s bootloader to be able to use this method.

    1. Hi Felix. It seems like you mistakenly declined the superuser request OR it timed out automatically and declined the request. Reboot your phone once and repeat the steps from the start. This time, when you enter ‘su’, you should see the superuser prompt appear on the screen, and then, you can grant the permissions.

  63. For me work perfectly! Unfortunately, my cell was wiped off. 😛 But, thanks to backup, evething is working fine now. Thanks for the tips! ^^

    1. Thanks for the confirmation! I am sure it was wiped when you unlocked the bootloader, right?

  64. The Xiaomi Mi A1 V10.0.4.0 Stock Boot Image doesnt worked here, so i used the Xiaomi Mi A1 V10.0.3.0 Stock Boot Image and worked!

    And really have to unlock the bootloader… i got wiped ://

    1. Hi Eric. You always have to use the stock boot image of the firmware version installed on your phone. So, if you have installed, you have to flash the stock boot image from and NOT I hope this clears it out.

      As for the bootloader unlock, yes, you will need to first unlock and it will wipe everything. Every tutorial on the internet warns the users about it. But I also understand that it can sometimes be overlooked. I have made that mistake too in the past.

  65. Can anyone confirm if this method wipes any data or it should all be kept once you reboot?

    1. Hi. It will only wipe the phone when you unlock the bootloader. If you already have an unlocked bootloader, then nothing would be wiped at all.

  66. entering “su” in Termux gets me a “Permission denied” notice
    I don’t see Magix Manager either. So the device seems to not be rooted.

    1. Hi Raka. The latest boot images are patched via Magisk 18.1, you shouldn’t see that problem anymore.

  67. entering su on Termux gets me a “Permission denied” notice
    I don’t see Magix Manager either after booting

    1. Hi Philipp. I’d like to make a small correction here. Unlocking the bootloader or performing this procedure will not disable OTA updates. You’ll still be able to take OTA updates normally.

    2. I got the upadte but installation problem occur in my phone.
      How to solve it now?

    1. I dont see Magisk Manager after booting patched_boot_V10.0.4.0.PDHMIXM.img
      And system doesn’t seem to be rooted

    2. Hi Alina, are you sure you entered the correct command to boot the Magisk patched boot image?

    1. Hi Shantanu, as I am writing this, I am doing a makeover of this post, with a much simpler method to enable Camera2 API on Xiaomi Mi A1 running Android Pie without root.

    2. Hi again, I have updated the post and written it from scratch. The method should work on Pie, I have tested for V10.0.4.0 (January 2019 Patch).

      Also, If you or anyone here wants to do the same on Android Oreo, all you will need is the patched boot image and replace it in the steps.

  68. Hey guys, after pie update this procedure doesn’t work,, tried several times. HAL3 & eis are not enabling. Can you give some solution without root my phone please??

  69. Does second method works on android version 9 running December security patch?

    Please let me know

  70. My mia1 updated to android pie Dec security patch. The 2 method is work or not in android pie ?? plz tell me

  71. November 2018 patch main 2nd method chalega kya plzzzz inform me… ? Data clear ho jane se mujhe koi problem nahi he … App sirf ye bataiye 2nd metod se camera2Api enable kar paunga ki nahi…?

    1. Hi. Yes, you can easily give a try to method 2. The data won’t be wiped at all.

    2. My data were wiped and Im starting all over again. I dont know what happened. I clearly followed every step. 🙁

  72. ~ First method: After booting into TWRP it stuck there. Asked for pattern unlock. After Unlocking, showed TWRP Menu. Don’t know what to next I did system reboot. Meanwhile on PC “Unlocking Bootloader…” stuck. After rebooting phone saw the Gcam added. Opened it after app permissions granted, the Gcam App crashed as usual. First method failed multiple times.

    ~ Second method: After Volume Down + Power button simultaneously to enter Fastboot mode, when I put fastboot oem unlock command phone data just erased automatically (factory reset)

    Half of the Sunday wasted with phone factory reset happened automatically multiple times with multiple attempt trying to follow the steps. Thank God I had auto backup of my data & high speed broadband.

    Yes, I installed updated adb drivers, unlocked boot loader with USB debugging enabled. BTW my Mi A1 was running Android Pie 9 official update, FYI

  73. I just upgraded my miA1 to android 9.0. Do i need to flash back my rom to oreo 8.0.0 to do all this step for enabling camera2api ?

    1. Hi bro,

      I am using mia1 I would like to install gcam on my mia. Now I updated android p Dec security update plz help me how can I install gcam without root??

    1. I got the upadte but installation problem occur in my phone.
      How to solve it now

    2. Hi. Which firmware build number is currently installed on the phone? Also, please state the device name, is it the Mi A2 or the Mi A2 Lite?

  74. Can I use the command “Disable” instead of enable to disable or restore the settings as previous.

    1. There’s nothing like disable. It is a property name. In order to disable it, just set its value to “0”. The following commands will help you understand what I am trying to explain:

      setprop 0

      setprop 0

    2. I already finished all the step but when i open the gcam its force close…i have try 4 gcam including given gcam.

  75. so i accidentaly clickling something while in twrp mode, it doenst install anything in my phone
    so i decided to install it one more time, it doesnt nothing and stuck at twrp menu
    what should i do?

    1. Once you boot into TWRP, do not touch anything. Simply connect the phone to the PC and run the commands as stated above.

      The second method will not install the GCam app. Once you have completed the commands, simply reboot the phone. Once booted, download the GCam port by Arnova8G2 and install it on your phone. That’s it.

    1. Kindly click on the “install drivers” button first and make sure the drivers are installed correctly.

  76. Im not able to use this after applying both procedure… camera app get closed.. Please help me … I want to use it.

    1. Even I faced this issue initially. Finally found out that the drivers were having issues. Kindly try reinstalling the drivers using the tool itself.

    2. what if I want to disable all this. I mean I want to restore all this, because of this I am facing Installation Problem while installing May 2018 Update. Please Help.

Leave a Reply

Your email address will not be published. Required fields are marked *