-Keep in mind that unlocking the bootloader will erase all the data on your phone (every single thing, including internal storage), hence it is preferable to unlock the bootloader when the phone is new, as then you don’t have to go through the hassle of re-installing everything.
This guide is applicable only for the LG Nexus 4. Do not try this on any other device.
The methods and procedures discussed here are considered risky and you should not attempt anything if you don’t know completely what it is. If any damage occurs to your device, I won’t be held liable.
How to Unlock Bootloader on Nexus 4
1. Backup everything on your phone, including the data on the internal storage, as unlocking the bootloader will erase every single thing on the phone.
2. Download and install the Android SDK → from here. This will install the necessary drivers for the phone on your computer. ( The drivers for your phone can be installed manually by other methods too, they are mandatory ) For the fastboot driver to install (and for fastboot commands to work), your device must be booted in fastboot mode.
3. Download Fastboot, which will be used for unlocking the bootloader.
Download Fastboot here .
4. Extract the Fastboot.zip file on your computer to get a folder named Fastboot with four files inside it. To keep things easy, extract the Fastboot folder to your C: drive.
5. Turn off your Nexus 4. Then, boot into fastboot mode by holding down the Volume down and Power buttons together till the screen turns on and shows “Start” written in big green letters.
6. Then, connect your Nexus 4 to the computer with your USB cable, then wait for Windows to finish installing the drivers (drivers will be installed only the first time). For reliability, ensure that you use a USB port at the back if you are using a desktop computer, as the front panel ports can be loose and cause problems.
7. Click on Start menu » All Programs » Accessories » right-click on Command Prompt and click on Run as administrator. If you are using Windows 8, this can be done by right-clicking on the extreme bottom left corner of the taskbar, then selecting “Command Prompt (admin)”
8. Now, perform the following steps in the command prompt to unlock the bootloader (check the screenshot after step 8.3 for reference)
8.1. Navigate to the Fastboot folder which you obtained in step 4. For example, if the Fastboot folder is in drive C on your computer, enter cd C:\Fastboot in command prompt (and press Enter) to navigate to the folder.
8.2. Then, enter fastboot devices. If your Nexus 4 has been detected properly, you will see a device ID show up in command prompt. If nothing comes up, make sure you have installed the drivers (step 2).
8.3. Finally, to unlock the bootloader, enter fastboot oem unlock in command prompt. You will get a prompt on the phone asking whether you want to unlock the bootloader. Just select Yes. Remember that this will wipe all your data, so make sure you took a backup.
9. The phone will then reboot, and once it starts up, you can set up your phone.
10. To re-lock the bootloader, simply follow the entire procedure again from step 5 to 8, but in step 8.3, enter fastboot oem lock. This will re-lock the bootloader.
The bootloader on your Nexus 4 is now unlocked, and you can start installing custom ROMs and make other modifications to the phone. Have fun!