Skip to main content

How to install Android N ( Version 7) on Nexus 5

You can install Android N (AOSP) build on your Nexus 5 and use the functionality such as multi windows support, quick notification reply on your Nexus 5 as well. 

Before going ahead, I would remind you that by following this method will void your device warranty/guaranty. There are chances that your device may get bricked (unusable). So make sure you follow the steps correctly and do not stop the process in between.


  • Working android SDK platform tools ( fastboot and dab)
  • Updated USB driver for your device installed on computer.
  • USB debugging enabled on device. Check this for how to enable USB debugging on mobile.
  • Download recovery from TWRP 
  • Download latest Android N (AOSP) image from xda-dev forum, you can choose any other image shared on forum.

Unlocking Bootloader

  • Once you have enabled USB debugging on device and connected device to computer execute below command on command prompt or terminal
    • adb reboot bootloader
  • Once your device restarted, check if the device is in fastboot by executing below command
    • fastboot devices
  • Above command should show your device serial number. If the device serial number is displayed then execute below command
    • fastboot oem unlock
  • A disclaimer will display on the device that must be accepted. Use the volume keys to cycle through the options. Pressing the power button should confirm your selection.
  • Reboot the device from menu if device does not rebooted automatically. Now the bootloader should be unlocked. After reboot if you see the unlocked icon on the bottom of boot screen menu. 
Installing TWRP recovery

  • Connect your device to computer via USB.
  • On command prompt or terminal execute below command
    • adb reboot bootloader
  • Check if the device is on fastboot mode like above. 
  • Make sure the recovery image is in the directory from where you are executing commands.
  • If the device is in fastboot mode, flash recovery entering below command
    • fastboot flash recovery recovery_image_file_name.img
  • Once the flash completes successfully, make sure you reboot the device. 
  • To check if the recovery completed successfully, reboot device in recovery mode, you should see the TWRP recovery menu.
  • In order to manually go to recovery mode -> Powered down the device. Now hold the Volume Down and Volume Up buttons. Then press and hold the Power button until a boot menu appears. Navigate using the volume keys and select RECOVERY using the Power key.
Installing Android N(AOSP)

  • Copy the Android image zip to SD card, you can use the below command to do the same after connecting your device to computer via USB. ( USB debugging is still on)
    • adb push /sdcard/ 
  • Reboot your device to recovery mode
In TWRP there is an option to backup. You should create a backup before installing custom ROM so that you can go back if anything goes wrong.
Once you have taken a backup:
  • Select Wipe and then Factory Reset.
  • Select Install.
  • Navigate to /sdcard and select the package.
  • Follow the on-screen notices to install the package.
Once installation has finished, return to the main menu and select Reboot, then System. The device will now boot into Android N.

You can follow the xda-dev forum for troubleshooting if required.


Popular posts from this blog

How to boot Samsung Galaxy SL( GT-I9003) in recovery mode

** I Will Not responsible for any damage done with use of below mentioned methods. ** Power off your Samsung Galaxy SL (GT- I9003) to start in recovery mode. Once you have power off the phone, press and Hold Volume UP and Home button. Make sure you have hold volume up, don't press in  the middle of the volume buttons.  Now keep pressing these two buttons(VOL UP + HOME) and presspower button for 2-3 seconds. Release only power button, but keep pressing Volume Up + Home Button, until you see the screen shown below. Once you see recovery screen release the Home button else your phone will restart as first selected option will be restart and pressing home will make that happen.

In the recovery mode, volume up & down act as a up scroll and down scroll buttons, by pressing Home button you will be able to click the selected option.

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

** I Will Not responsible for any damage done with use of below mentioned methods. ** To flash the CWM recovery to your Samsung Galaxy SL you will require to following things in place: Odin  : you can download it from here.CWM Recovery image : you can download it from here. Thanks to XDA-developers. USB driver to connect your phone with computer. Install Samsung Kias so it will install the USB driver. Once you have downloaded above required items and installed the USB driver, reboot you phone to download mode. You can read how to reboot phone in download mode from here. Now connect the phone with USB cable to computer. 
Extract the Odin from the zip file that you have downloaded at some location on your computer and launch the Odin executable by double clicking it. Wait for Odin to detect your phone.You will be able to see it in yellow once detected on odin screen as shown below.
Click the PDA button to select the CWM recovery image. Once you have selected the recovery image, check the od…

Exception handling with RestTemplate

Spring framework offers RestTemplate for consuming RESTful services. Recently I used RestTemplate for consuming one of the third party RESTful service.

RestTemplate offers 'ResponseErrorHandler'; which you can extend to decide which are errors for you and how to handle those error. You can override hasError and handleError methods of ResponseErrorHandler.
In handleError you can throw customException if you want, as outlined in below code.

import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.ResponseErrorHandler; import; public class RestTemplateErrorHandler implements ResponseErrorHandler { @Override public void handleError(ClientHttpResponse response) throws IOException { throw new MyCustomException(response.getStatusText(), response.getStatusCode()); } @Override public boolean hasError(ClientHttpResponse response) throws IOException …