In this tutorial, you will learn how to enable Camera2 API on Xiaomi Mi A2 and Mi A2 Lite without root. Once enabled, you can download ports of various versions of the Google Camera app from below and install it on your phone.
In the past few years, Google Camera (GCam) Port from Pixel devices has gained immense popularity. But it is not just known for the amazing and latest features, it also enhances the camera quality and allows you to take great pictures using AI software. It is, in several ways, better than the stock camera app that comes pre-installed on the phone.
But in order to install Google Camera Port, you must first enable Camera2 API on your Xiaomi Mi A2/A2 Lite. Even though Xiaomi phones run the stock Android software, they still do not support Camera2 API officially. It’s easy to enable it when your phone is rooted, by editing the build.prop file manually or using a Magisk module.
But if your phone is not rooted, you will need to follow a different approach. And this guide will take you through the same. So, just follow the instructions below to first enable Camera2 API without root and then install Google Camera Port on Xiaomi Mi A2/A2 Lite.
Related Article: How to Root Xiaomi Mi A2/A2 Lite without TWRP (Magisk)
Table of Contents
Download Patched Boot Image
Here, we have provided Magisk Patched Boot Images for Mi A2 and Mi A2 Lite to temporarily root it. We have also provided stock boot images for the corresponding firmware, to help you unroot if you mistakenly flash the image.
Starting with the January 2021 update, patched boot images will not be provided on this page. I do not own this device anymore. You can easily patch the stock boot image on your phone itself by following step #2 of this tutorial.
For Xiaomi Mi A2 (jasmine_sprout)
|V22.214.171.124.QDIMIXM||Stock Boot Image||–|
|V126.96.36.199.QDIMIXM||Stock Boot Image||–|
|V188.8.131.52.QDIMIXM||Stock Boot Image||–|
|V184.108.40.206.QDIMIXM||Stock Boot Image||–|
|V220.127.116.11.QDIMIXM||Stock Boot Image||–|
|V18.104.22.168.QDIMIXM||Stock Boot Image||Patched Boot Image|
|V22.214.171.124.QDIMIXM||Stock Boot Image||Patched Boot Image|
|V126.96.36.199.QDIMIXM||Stock Boot Image||Patched Boot Image|
|V188.8.131.52.QDIMIXM||Stock Boot Image||–|
|V184.108.40.206.QDIMIXM||Stock Boot Image||–|
|V220.127.116.11.QDIMIXM||Stock Boot Image||–|
|V18.104.22.168.QDIMIXM||Stock Boot Image||Patched Boot Image|
|V22.214.171.124.QDIMIXM||Stock Boot Image||Patched Boot Image|
|V126.96.36.199.QDIMIXM||Stock Boot Image||Patched Boot Image|
|V188.8.131.52.QDIMIXM||Stock Boot Image||Patched Boot Image|
|V184.108.40.206.QDIMIXM||Stock Boot Image||Patched Boot Image|
For Xiaomi Mi A2 Lite (daisy)
|V220.127.116.11.QDLMIXM||Stock Boot Image||–|
|V18.104.22.168.QDLMIXM||Stock Boot Image||–|
|V22.214.171.124.QDLMIXM||Stock Boot Image||–|
|V126.96.36.199.QDLMIXM||Stock Boot Image||–|
|V188.8.131.52.QDLMIXM||Stock Boot Image||Patched Boot Image|
|V184.108.40.206.QDLMIXM||Stock Boot Image||Patched Boot Image|
|V220.127.116.11.QDLMIXM||Stock Boot Image||Patched Boot Image|
|V18.104.22.168.QDLMIXM||Stock Boot Image||Patched Boot Image|
|V22.214.171.124.QDLMIXM||Stock Boot Image||Patched Boot Image|
|V126.96.36.199.QDLMIXM||Stock Boot Image||Patched Boot Image|
|V188.8.131.52.QDLMIXM||Stock Boot Image||Patched Boot Image|
|V184.108.40.206.QDLMIXM||Stock Boot Image||Patched Boot Image|
How to Enable Camera2 API on Xiaomi Mi A2/A2 Lite without Root?
The process is quite easy. In order to enable the API, you must first boot the patched boot image to temporarily root your phone. Once that is done, you can use a Terminal Emulator to execute the commands that will enable Camera2 API. Once the API has been successfully enabled, you can reboot your phone to fully unroot and then install the Google Camera Port. By using this method, you will still be able to take OTA updates without any issues.
In order to temporarily boot the patched boot image, you will need to install Android SDK Platform-Tools on your PC and unlock the phone’s bootloader first. Once done, follow the steps below to enable Camera2 API on your Xiaomi Mi A2/A2 Lite.
- Download the patched boot image for the software build number installed on your phone.
- Extract the contents of the downloaded ZIP file to get the ‘magisk_patched.img’.
- Copy the extracted patched boot image file to the folder where the ADB/Fastboot tools are installed on your PC (e.g. C:\platform-tools).
- Now, launch the command-line inside the Platform-Tools folder.
- Power off your phone completely. Then hold the Volume Down and Power buttons simultaneously to boot it into Fastboot Mode.
- Connect your phone to your PC using a USB cable.
- Enter the following command to temporarily boot the Magisk patched boot image on your Mi A2/Mi A2 Lite:
fastboot boot boot-image-filename.img
- Replace “boot-image-filename.img” with the actual filename of the patched boot image you’re using. For example, if you downloaded the V220.127.116.11 patched boot image, then the command should be the following:
fastboot boot magisk_patched.img
- Just as the command is entered, your Mi A2/Mi A2 Lite should boot into the OS with temporary root.
- Right now, only the Magisk Manager stub is installed on your phone. In order for Magisk to work properly and to grant superuser permissions, you must first install the full Magisk Manager.
- Simply go to the phone’s app drawer and launch the Magisk Manager app (In case the app doesn’t show up, download the latest APK from here and install it on your phone).
- Note: Make sure that you install the app to the internal storage only, and not to the SD card via Adoptable Storage.
- Select “Yes” when prompted to upgrade to full Magisk Magisk Manager and follow the on-screen instructions.
- Once Magisk Manager is fully installed, download and install Termux (Terminal Emulator) on your phone
- Once installed, launch Termux and enter the following command:
- Grant superuser permissions to Termux when prompted
- Finally, enable Camera2 API on Xiaomi Mi A2/A2 Lite by entering the following command:
setprop persist.camera.HAL3.enabled 1
setprop persist.vendor.camera.HAL3.enabled 1
setprop persist.camera.stats.test 5
setprop persist.vendor.camera.stats.test 5
- Once the commands have executed successfully, reboot your phone to uninstall Magisk and unroot completely.
For further confirmation, you can also check Camera2 API support using an app. And finally, follow the next section to install Google Camera Port on Xiaomi Mi A2/A2 Lite.
Download Google Camera Port for Xiaomi Mi A2/Mi A2 Lite
There’s no dedicated Google Camera Port, you can try different versions from here. However, after digging enough on XDA forums, I was able to find a few versions of the Google Camera ports for the Mi A2 and Mi A2 Lite.
As of 13 November 2019, Google Camera 7.2 and 7.0 Ports for Xiaomi Mi A2 and Mi A2 Lite are available for download. v7.2 ports are only compatible with Android 10, while v7.0 ports can be installed on both Android 9 Pie and Android 10. Thanks to Kwanthay for tipping us!
General advice: Not all GCam Ports are perfect, some features like NightSight and HDR+ might be buggy on some ports, while not on some others. I have tried and gathered the most stable ones as recommended by the users themselves on XDA forums. Start by trying the first port listed and move down to test other versions until you find the one that works best for you.
Google Camera v7.3.020 Ports by Parrot043
Google Camera 7.2.018 Ports:
Google Camera 7.0.009 Ports:
- GCam_v7.0.009-v4.4.apk (by Urnyx05)
- PMGC_7.0.009_Astrophoto_Version_V12.apk | Config file
- DMGC_7.0.009_ver.0.3-dogfood.apk (by the_dise)
Google Camera 6.3.017 Port:
Google Camera 6.2.030 Ports:
- Gcam_6.2.030_Advanced_V2.2.190716.1800-Final.apk (by Arnova8G2)
- GCam-6.2.030_Arnova8G2_Urnyx05-v2.4.apk (by Urnyx05)
- DMGC_6.2.030_ver.1.6-PE.apk (by the_dise)
Google Camera 6.1.021 Ports:
How to Install
- Download Google Camera Port for Xiaomi Mi A2/A2 Lite
- Open a file manager app on the phone
- Navigate to the location where the APK file was downloaded
- Tap on the APK file to install Google Camera Port on Xiaomi Mi A2 and Mi A2 Lite
- Follow the on-screen instructions to finish the installation
- Once Google Camera has been installed, go to the app drawer and launch it
So, this was how you can enable Camera2 API on Xiaomi Mi A2/A2 Lite and install Google Camera Port on it. If you have any questions, please leave them down in the comments.
Huge thanks to f.y, Roy Goldberg, Nico van Draanen, and 4KhadaJhin4 for their contribution.