How to Enable Camera2 API on Redmi Note 5 Pro/Global

How to Enable Camera2 API on Redmi Note 5 Pro/Global 1

There are 3 methods to activate MIUI Camera2 API you can follow easily on Redmi Note 5 codename Whyred (Pro/Global/China/AI). The first and second methods require no root. The third method, however, is the ultimate trick that requires rooting your phone.

Either with root or without root, enabling Camera2 API on your Xiaomi device requires an unlocked bootloader. Any method you try will just fail if your phone bootloader is not unlocked officially. Unlocking bootloader is utterly easy. We have wrapped up the complete steps to obtain bootloader unlock permission here.

Before we proceed, make sure you have created a backup of all your important files and data. Despite this method is perfectly safe, we cannot guarantee anything. We have no responsibilities of any damage that might happen to your device.

Requirements

You will need the following stuff:

1. No Root, No TWRP Flashing

This method requires TWRP custom recovery but we are not going to install it. We need it only for booting into custom recovery. Again, you will have no TWRP installed at the end of this process.

  1. Disable Windows Driver Signature Enforcement on your computer.
  2. Install ADB Fastboot Driver or Android Platform Tools on your computer. You may install it on drive C:\adb\.
  3. Enable USB Debugging on your phone. Go to Settings >> Additional Settings >> Developer Options >> USB Debugging.
  4. Download and copy the TWRP image file to your ADB folder. Rename the file to twrp.img.
  5. Download ARB Bypasser and extract the zip file. You will get a dummy.img file. Copy that file to the adb folder as well.
  6. Hold down the “Shift” button your keyboard and right-click anywhere inside the ADB folder.
  7. Choose “Open Command Prompt Window here” or “Open Windows PowerShell Window here”.
  8. Now connect your phone to your computer using the prepared USB cable. Make sure the connection type is “MTP” and is NOT “Charging”.
  9. In the Command Prompt window, type “adb devices” (without quotes) and hit Enter key. This asks the computer to recognize your device and to establish ADB connection.
  10. Next, type “adb reboot bootloader“. This will reboot your phone into fastboot mode.
  11. If your device has ARB index 4 or greater, type “fastboot flash antirbpass dummy.img” and hit Enter. The command order your computer to flash dummy.img file to your device through the Fastboot interface. Otherwise, skip this step and go to the next step below. Recommended reading: How to check for ARB index.
  12. Now issue the following command: fastboot boot twrp.img. This tells your computer to boot your phone using TWRP image.
  13. Your phone should now display the TWRP main menu but you may need to allow system modification at first.
  14. Next, type “adb pull /system/build.prop” and hit Enter. The command asks the system to download “build.prop” file from our device to your computer.
  15. Open the “build.prop” file using a text editor of your choice (Notepad, Notepad++, or Sublime).
  16. Add the following text inside that file “persist.camera.HAL3.enabled=1” – you can copy-paste it, without quotes.
  17. Save the file (Control+S) and close the text editor.
  18. Finally, issue the following command lines:

Type and hit Enter on your keyboard.

adb push build.prop /system/
adb shell
cd system
chmod 644 build.prop
adb reboot

Credit: Sahil4518 on XDA.

Alternative method:

  1. Follow Steps 1 until Steps 12 above.
  2. Then issue the following command:
adb devices
adb shell
setprop persist.camera.HAL3.enabled 1
exit
adb reboot

Your phone will reboot into normal mode but this time the Camera2 API has been enabled.

ALSO READ:  Flash TWRP and Root Mi Note 10 (CC9 Pro) in 15 Steps

Credit: RSubha on XDA.

As for us, this alternative method that really works.

How to Enable Camera2 API on Redmi Note 5 Pro/Global 2

2. No Root, with TWRP

  1. Disable Windows Driver Signature Enforcement on your computer.
  2. Install ADB Fastboot Driver or Android Platform Tools on your computer. You may install it on drive C:\adb\.
  3. Enable USB Debugging on your phone. Go to Settings >> Additional Settings >> Developer Options >> USB Debugging.
  4. Download and copy the TWRP image file to your ADB folder. Rename the file to twrp.img.
  5. Download ARB Bypasser and extract the zip file. You will get a dummy.img file. Copy that file to the adb folder as well.
  6. Download the Camera2 API Enabler (zip) and DM-Verity No Encrypt (zip) to your phone directly. Do not need to extract the zip file.
  7. Hold down the “Shift” button your keyboard and right-click anywhere inside the ADB folder.
  8. Choose “Open Command Prompt Window here” or “Open Windows PowerShell Window here”.
  9. Now connect your phone to your computer using the prepared USB cable. Make sure the connection type is “MTP” and is NOT “Charging”.
  10. In the Command Prompt window, type “adb devices” (without quotes) and hit Enter key. This asks the computer to recognize your device and to establish ADB connection.
  11. Next, type “adb reboot bootloader“. This will reboot your phone into fastboot mode.
  12. If your device has ARB index 4 or greater, type “fastboot flash antirbpass dummy.img” and hit Enter. The command order your computer to flash dummy.img file to your device through the Fastboot interface. Otherwise, skip this step and go to the next step below. Recommended reading: How to check for ARB index.
  13. Now flash TWRP using this command: fastboot flash recovery twrp.img
  14. This instructs the computer to flash TWRP image file to the phone through the fastboot interface. The process should finish within seconds.
  15. Type “fastboot reboot recovery” and hit Enter. This will boot your device into TWRP.
  16. Your phone will now reboot into TWRP recovery mode.
  17. Slide to allow system modification. By doing this, it will trigger the MIUI DM-Verity security check.
  18. Choose “Install” from the main menu.
  19. Locate and choose the Camera2 API .zip file. Tap on it to choose it.
  20. Swipe to confirm flashing. Wait few seconds until the process complete.
  21. Go back to the main and tap “Install” again.
  22. Locate and choose the DM-Verity Disabler .zip file.
  23. Tap on it to choose it.
  24. Swipe to confirm flashing. Wait few seconds until the process complete.
  25. Once done, tap “Reboot”

3. With Root, with TWRP and Magisk

  1. Follow our comprehensive guide on how to root Redmi Note 5 Whyred.
  2. Open up Magisk Manager app.
  3. Tap the menu icon at the top left corner of the screen.
  4. Choose “Downloads”.
  5. Tap the Search icon.
  6. Search for “Camera2 API“.
  7. Tap the Download icon to start downloading.
  8. Tap “Install” then reboot.

How to Enable Camera2 API on Redmi Note 5 Pro/Global 3

How to Enable Camera2 API on Redmi Note 5 Pro/Global 4

How to Enable Camera2 API on Redmi Note 5 Pro/Global 5

What’s next? You can confirm whether your attempt is a success or not. Simply download the “Manual Camera Compatibility Test” app or “Camera2 Probe” app from the Play Store. You should get something like this:

How to Enable Camera2 API on Redmi Note 5 Pro/Global 6

Credits: jhangyu on XDA.

UPDATE:

Users running MIUI 10 based on Android 9.0 Pie should follow our latest guide:

How to enable Camera2 API on Redmi Note 5 MIUI 10 Android 9.0 Pie.

Do not hesitate to post a comment below.

Tags:

46 thoughts on “How to Enable Camera2 API on Redmi Note 5 Pro/Global”

  1. Well, I tried 1st method but I got “System has been destroyed” message! But my bootloader was locked and I was able to boot my phone as usual.
    Now I have unlocked bootloader but I’m afraid to try again… What if I brick my device?
    I’m on Global verson of Redmi Note 5, whyred.

  2. Can anyone confirm a working method from above? If method 3, with root, does not work, what are the chances that the other 2 without root will work? I only have a unlocked bootloader and don’t want to root the phone in order to get cam2api enabled…
    So?
    Thank you!

    1. That usually occurs due to the locked bootloader. Make sure you have received the official bootloader unlock permission from Xiaomi. For that situation, you need to reinstall the MIUI ROM

  3. @Jas:
    I got the same message when my bootloader was locked. But my phone boot it normally. Now i unlocked the bootloader and ready to try again, and, if Fandi is right, I should not have any problem at all.
    So, you have a locked bootloader?

  4. It seems that even I swiped right to allow system modification, I also had to mount system partition from TWRP in order to pull build.prop from system.

  5. It has something to do with allowing the system partition to be modified.
    Even if I swipped right, I couldn’t access build.prop file. As soon as I mounted system partiiton from twrp menu, I was able to extract build.prop, modify it and put it back to it’s place, rebooted and ok… from the second try, I CAN CONFIRM, METHOD 1 WORKING!
    THANK YOUUUUUUUUUUUUU!

  6. But I didn’t manage to get an working gcam for me… tried all sort of gcam ports… maybe some v5 port are fully functional but no night sight option and the one that have this option, v6 and above, give force crash on front camera and no 4k working… Cannot understand a thing from crash log…
    I’m on stock, MIUI 10 v.10.2.2.0, no root, Redmi Note 5 global SD636…
    I don’t know what is happening…

  7. hello,
    I have bootloader unlocked, everything works great until:
    “12 step “Now issue the following command: fastboot boot twrp.img. This tells your computer to boot your phone using TWRP image.”

    It appears the error:
    “PS C:\adb> fastboot boot twrp.img
    cannot load ‘twrp.img’: No such file or directory”

    adb is on “C:\adb\”.

    What am I missing here? thanks in advance

    1. You need the “twrp.img”. Make sure your Recovery image is renamed to twrp.img or you can adjust the command according to the name of the actual file. For instance, if your recovery image file is named as recovery.img, you can use fastboot boot recovery.img

  8. @Fariez, I have done just that, step by step. It always says “cannot load ‘twrp.img’: No such file or directory”. And I don’t why, but for sure I’m missing something.
    I unlocked the bootloader on windows 7 and activation of Camera2 API on windows 10. Could it be it the cause of the error?
    Thanks

  9. UPDATE: I made a mistake, I renamed the file “twrp.img” but Windows was already assuming that file was a image file, so, technically the file became “twrp.img.img”. That’s why it couldn’t find the file or directory.
    I just did it and it works. Thanks, mate. 🙂

  10. hello, i’ve try the steps above and my result for Hadware support level is LEVEL_3, are its mean i have complete enable my camera api?

  11. What version of Windows did you guys used when you did the procedures? Also, is your computer still on USB 2.0?

  12. Please answer me! Will it work on MIUI Global 10.2.2.0 ???
    I have Redmi Note 5 Global version and im about to try the 1st method.

    1. Sure, of course it will work!
      But after the next OTA update, in fact after each OTA update, cam2api will will be reset and lost and have to do the procedure all over again!
      In any case, you should have your bootloader unlocked.
      Cheers!

  13. i am running the fastboot boot “recovery image” command it shows failed. status read too many links. and my phone displays system destroyed.
    help me please

  14. I have flashed the TWRP and install the magsik manager. But on rebooting the phone my camera2api gets disable. Moreover even with the camera2api enabled I cannot successfully run a gcam app that works with front and back camera.After reading this article, I have check that and my anti rollback feature is at index 4. I already have TWRP in my Phone what should I do to permanently enable camera2api or disable the antiroll back feature while TWRP is already on the phone. also can you please recommend a gcam version of app that run without any issue.

      1. the problem is that when I enable the camera2api, it works and camera2proble shows green signals. but once the mobile is reboot, all settings are gone. How could I avoid this? and how could I bypass anti-rollback 4 even TWRP is already installed and the phone is rooted?

  15. also I have already given a try to each of these camera builds and nothing works for me. either the app crash or black front camera. May be this antirollback feature not allowing the camera to work properly. That is why I asked how can I bypass anti rollback at level 4 when my phone is rooted and I already have twrp

      1. Then why I cannot run any ported app even that you mentioned? Please help me with that.
        Camera 2 probe is ok… But front camera is just blackout for all the apps.

    1. the official TWRP does not have data decryption. Your have 3 options:
      1. Format your data (it works but you’ll lose data)
      2. Try removing all screen lock/PIN/password including hidden files/folders (sometimes doesn’t work)
      3. Use Red Wolf or Orange Fox (easiest)

    1. That depends on the Camera app you use. Basically, the Camera2 API only gives necessary access to the advanced level of camera hardware features. What features to make available to end-users totally depend on the app you use. 🙂

Leave a Reply

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