How to Update Nexus 5 or 7 to the Android L Developer Preview

Want to try out the Android L preview announced at Google IO on your Nexus 5 or 2013 Nexus 7 but do not know where to start? Follow this guide to get your Nexus 5 or Nexus 7 flashed to the latest Android L OS from Google. I have a Nexus 5 and wanted to try it out. I thought since I was doing it anyway for myself, I would document the process to share. I hope you find it useful.

*Important*: please note that this is a Developer Preview. That means things are still broken, there are bugs, and a number of apps simply won’t run on it yet. It has only just been released, so undoubtedly things will improve over time as the official launch nears, but I would NOT recommend putting this on your “daily driver” or your primary/only phone right now (June 2014).

First backup your device. Backup everything that is important to you and store in on your computer. Seriously, do this – everything will be erased in the following guide.

Make sure you have the Android SDK downloaded and unzipped into a folder (we will call it “Android”) and have located the “platform-tools” folder within the sdk folder: ~Android/sdk/platform-tools. Note, if you are on a Windows PC, it may be easier to install this much smaller Windows ADB installer – it contains everything you need: adb, fastboot, and drivers. If you are on a Mac you do not have to worry about drivers.

Get the factory image for your device. Unzip and move the contents into the “platform-tools” folder or wherever adb and fastboot are located.

One of the best ways to familiarize yourself with the process is to open the included scripts (flash-all.sh or flash-all.bat) in a text editor and look at the commands. The scripts are easy as you can just type in one command and everything gets installed, but if something goes wrong you need to know what has happened.

Note: I am using a Mac so all commands will start with “./” in terminal. If you are using a Mac, type ./ immediately proceeding any adb or fastboot commands. If you are using windows you can just type the commands without the “./” in front. The adb and fastboot commands that you need to type into terminal or command prompt will be center-justified and in bold.

The following step-by-step guide to flashing Android L developer preview is specifically for the Nexus 5 with the initial release, so if you are using a Nexus 7 (2013) or a subsequent Android L release, you may need to adjust the file names near the end of the guide. Each step will be followed by screenshot(s) demonstrating that step.

Step 1 – Enabling USB Debugging

Plug in your Nexus device into your computer with a USB cable

On your device go to Settings → About phone → Build number → tap on Build number until you see a notification that says, “You are now a developer” → tap the back key → Developer options → now check the box next to USB debugging to turn it on.

Nexus 5 build number
Nexus 5 dev options

Step 2 – Open Terminal and Locate ADB and Fastboot

On your computer open terminal (on a mac) or command prompt (on a windows pc) and type: “cd” without the quotes, hit the spacebar once, now drag the “platform-tools” folder into the terminal window so that it looks like:

cd *your-folder-location*/sdk/platform-tools

Now press return (enter on Windows). This tell the computer you are working in the “platform-tools” folder so you no longer have to specify the location of files.

SDK Developer Tools

Step 3 – Set up ADB and USB Debugging

Now on your computer, in terminal or command prompt, type the following command (remember ./ is required immediately preceding the command on Macs):

adb devices

If you have never used adb on your computer/phone before, the serial number of your device will show up under “List of devices attached” in the terminal window but it will say, “unauthorized” next to it. To fix this, check you phone, there will be a notification asking you to, “Allow USB debugging? The computer’s RSA key fingerprint is….” Check the “Always from this computer” box and then “OK.”

allow usb debugging

After allowing USB debugging on your device, type in the adb devices command again and the output in terminal will be your device’s serial number with just the word “device” next to it.

adb devices

Step 4 – Reboot into the Bootloader and Fastboot Mode

Now set your phone/tablet aside leaving it connected to the computer. We are going to do everything else on the computer. Now type the command:

adb reboot bootloader<

ADB reboot bootloader

This will reboot the device’s bootloader. Let the device reboot into fastboot mode. It will look like this:

fastboot mode locked

Check to make sure fastboot is now recognizing your phone by typing:

fastboot devices

You should see that your device is connected as before.

Step 5 – Unlock the Bootloader

If you have never unlocked the bootloader, you will need to do that now, otherwise skip to step 6. To unlock the bootloader (this will erase all your files) type the command:

fastboot oem unlock
Fastboot oem unlock

As soon as you type this command, look at your device – a warning regarding unlocking your bootloader will appear requiring you to press the up volume key followed by the power button to select, “Yes, unlock bootloader.”

Nexus 5 unlock bootloader

Step 6 – Run Installation Script and Troubleshoot if it Doesn’t Work

If your bootloader is already unlocked and you skipped step 5 erasing system and user data is a good idea. To do so enter these commands:

fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata

You are now ready to run the script that uses fastboot to flash the new bootloader, radio, and other update files. Remember the unzipped contents of the Nexus factory image must be in the same location as fastboot, namely, the Platform-tools folder. There should be 6 files that you unzipped and copied into the Platform-tools folder: a bootloader and radio .img files, 3 scripts (flash-all.sh, flash-all.bat, and flash-base.sh), and finally the image.zip file.

To run the script on a mac type in terminal:

./flash-all.sh
flash-all.sh script

If you are on a windows machine type the following into command prompt:

flash-all.bat

More than likely, the script will fail as shown in the screenshot below. Do not panic, this is a common problem.

flash-all.sh script error flash-all.sh script fixed

The script should now work. It will reboot your phone back into the bootloader a few times and there will be a lot of activity in the terminal window showing its progress of sending and writing all of the new Android L files. This process should take about 2 minutes or so until the terminal script ends:

flash-all.sh script finished

Assuming the script worked, you are done! At this point you can exit the terminal or command prompt. Your Nexus 5 or 7 will now reboot and you will see a cool looking new boot animation… for a very long time. I timed mine at about 5 minutes before it actually booted from the time the boot animation started, so just leave the device alone for maybe 10 minutes before worrying about a boot-loop.  Just wait for your device to start up and begin enjoying Android L. Do not proceed to step 7 unless the script failed.

Step 7 – Flashing the Android L files without the script:

If, for whatever reason, you cannot get the flash-all script to work, do not worry, it is very simple – just 5 fastboot commands that you can do manually. In order to get the file names correct I would suggest either copy/pasting the names in or editing the file names to much simpler things like, bootloader.img, radio.img, and update.zip. For the example below I am going to use the actual (but complex) names of the Nexus 5 files. Enter each of these commands in order, and wait until it is completed before entering the next command:

fastboot flash bootloader bootloader-hammerhead-hhz11k.img
fastboot reboot-bootloader
fastboot flash radio radio-hammerhead-m8974a-2.0.50.2.08.img
fastboot reboot-bootloader
fastboot -w update image-hammerhead-lpv79.zip

That should be it. Enjoy the Android L developer preview. If you have any questions or comments please leave them below. If this guide helped you please like or 1+ this post. Thanks.