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.
Note: If the patched boot image for a specific firmware version is not provided, you can easily self-patch it using Magisk by following the instructions under Step #2 of this tutorial.
For Xiaomi Mi A2 (jasmine_sprout)
For Xiaomi Mi A2 Lite (daisy)
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).
- Hold the SHIFT key and right-click on an empty space inside the folder.
- Select the ‘Open PowerShell window here’ option.
- 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 V22.214.171.124 patched boot image, then the command should be the following:
fastboot boot patched_boot_V126.96.36.199_mi_a2.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:
- MGC_6.1.021_MI8_V2e.apk (Thanks Rae!)
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.