Some camera apps on Android, like the modded Google Camera, use Android’s Camera2 API but it’s disabled on Xiaomi devices by default (with the exception of the Mi 5s). If Camera2 is disabled, such apps (like GCam) don’t work and crash on launch. Thankfully, TWRP lets you modify build.prop in ADB mode and thus enable Camera2.
If the device asks for decryption password, input the PIN/password you use on your lock screen.
Keep the system read only, when asked.
Download and launch the Xiaomi ADB/Fastboot Tools from here.
Connect the device to your computer. The application should detect it automatically.
On the ADB tab, in the Camera2 module, enable camera2, as well as EIS if you want to.
If successful, reboot the device by clicking Reboot device to System in the top menu.
After successfully enabling Camera2, you can install a Google Camera port from here. Be advised, however, that different versions work on different models and different ROMs so there’s no universal option, but you can find recommendations for a variety of devices here.