Though Nexus 4 is a five year old device, the device has got latest Android 8.0 Oreo build. An XDA developer Ziyan has released a near stock (AOSP 8.0) custom ROM based on the Android 8.0 Oreo for Nexus 4 (mako) that you can flash via custom TWRP recovery. The AOSP 8.0 ROM (Android Open Source Project) is experimental, but you can try it out right now.
If you are interested and want to experience the latest Android 8.0 Oreo, here is how to flash AOSP 8.0 custom ROM on Nexus 4. The ROM is initial build and experimental. However, except few glitches (like broken mobile data, NFC, Sensors), the ROM is fully functioning. Interested users can download and install the ROM right now.
Installing Android Oreo based AOSP 8.0 ROM (mako) on Nexus 4 is a simple process, if your device is bootloader unlocked and have latest version of TWRP recovery (version 3…) installed on it.
Note: If you are still on the old Android Lollipop, install latest version of LineageOS and then clean flash this ROM.
Before proceed, we remind you to backup every data you have on the phone on a safe location. Also, make sure your phone is fully charged.
2. Boot your phone into TWRP recovery mode.
3. In TWRP recovery, select ‘Wipe’ and perform a factory reset, wipe data and the Dalvik cache.
4. Now, tap on the ‘Install’, navigate and select the ROM zip file. Confirm the action by swiping the arrow to the left.
5. Once installation has finished, return to the main menu and select Reboot, then System. First time it will take longer time (5-10 minutes) to boot up.
Note: If you come across bootloop, in TWRP select Wipe and wipe cache and dalvik cache and then reboot your device. (Source – XDA).