Nexus 5 users, who wish to unbrick their devices and restore stock Android firmware, may follow our step-by-step guide. Unbricking means the device will lose root access, custom recovery and all other customisations that are installed. Besides, with the installation of a Factory image, the data files will be wiped completely.
Note that a Factory Image is a full stock copy of Android that can be flashed on a device when it is bricked.
IBTimes UK reminds its readers that it will not be held liable for any damage to the devices. Before following the method users are advised to verify their devices meet following requirements.
1) Install USB Driver for Nexus 5 to transfer files between the Android device and the computer.
2) Enable USB Debugging Mode on the tablet to connect it with computer and use Android SDK with it. [Navigate to Settings>> About phone. Tap on Build Number several times until a message appears saying 'You are now a Developer.' Now enable USB Debugging Mode by navigating to Settings>> Developer Options.]
3) As the tutorial might wipe out all data of the phone, create a backup. If the device is having any custom recoveries such as ClockworkMod or, TWRP then backup data using the recovery.
4) If the Android device powers off due to lack of battery while the rooting process, it could damage the device. Therefore, the Nexus 5 should have charge above 80% battery charge.
5) The bootloader of the phone should be unlocked. Click here for our guide to unlock bootloader of Nexus 5.
6) This unbrick method works with Google Nexus 5 codenamed 'hammerhead.' As applying these on any incorrect variant might brick the device, verify the model number of Nexus 5 by navigating to Settings>> About phone>> Model number.
How to unbrick Nexus 5 using Factory image from Google
Step-1: Download the latest Android Factory image for Nexus 5
Step-2: Extract the .tgz archive content on the computer. Save the file on the computer
Step-3: Switch off the smartphone
Step-4: Boot the phone into Fastboot mode [Click here for a guide]
Step-5: Connect the Nexus 5 to the computer using USB cable
Step-6: Navigate to the Factory image foelder created in step-2 and launch flash-all.bat script on Windows. For Mac and Linux open flash-all.sh
Step-7: Wait for some time until the installation process is completed
Step-8: When the process is completed, go to the device's Fastboot screen and select Recovery option
Step-9: Press the Power button to boot the device into Recovery Mode
Step-10: Select wipe data/factory reset and confirm the process
Step-11: Select the Reboot option and wait until the device boots up into normal mode. You may now safely unplug the USB cable form the Nexus 5 when it boots in Android stock operating system.
[Source: Android Geeks]