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.
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:
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.
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):
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.”
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.
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:
This will reboot the device’s bootloader. Let the device reboot into fastboot mode. It will look like this:
Check to make sure fastboot is now recognizing your phone by typing:
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:
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.”
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 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:
If you are on a windows machine type the following into command prompt:
More than likely, the script will fail as shown in the screenshot below. Do not panic, this is a common problem.