• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How To Install Android M on Nexus 5

steve

Developer
Administrator
Apr 19, 2011
1,086
1,181
40
York, PA
codeversed.com
Android M Developer Preview on Nexus 5

Prerequisites
  • Common understanding and experience using tools that are provided with the Android SDK such as Fastboot and ADB.
  • Fastboot and ADB installed on your system and PATH variables updated accordingly.
  • Understand that this will wipe all of your device data and that you will first need to backup any files, apps, etc that you do not want to lose!
  • You will also obviously need a Nexus 5. Do not try any images on devices they are not intended for as it will cause issues and not work!
WARNING Installing a system image on your device will remove all data from the device. Please make sure that you backup your data before you proceed. Also, keep in mind that these images are not final releases and may have bugs or unfinished features. These are Developer Previews and not meant for the average consumer.

Step 1 – Unlock your bootloader in Developer options
Please continue to the next step if you already have your bootloader unlocked. If not, or you forget whether or not it’s unlocked, I will walk you through the process.

Enable OEM unlocking (aka unlock your bootloader)
  1. Go into Settings -> Developer options on your device.
    If you do not see Developer options listed in this list, please click on About phone and keep tapping on Build number until you see “You are now a developer”. What this means is you now have a Developer options in your main Settings list. Please go to Settings -> Developer options now.
  2. Once you are in Developer options, look for OEM unlocking. This is a simple switch or checkbox that you need to enable. It will prompt you to Allow OEM unlocking and give you a warning message. Please click the enable to accept and continue.
Step 2 – Download the Nexus 5 specific image
Below is the direct link to download the Android M preview images. This is only for the Nexus 5!
Step 3 – Decompress the image file
All of the necessary image files that you will need are located in this “tgz” compressed file.

Windows Users
You will need to install a third-party tool to extract this gzip tar file and we recommend 7-zip. It’s free and works great but does NOT treat .tar.gz extract as one atomic operation. You will first extract the main .tgz file and the result will be a .tar file. Use 7-zip again to extract one more level and you will now see actual files.

If you already setup 7z as a system path variable, you can use one command in command prompt (aka cmd.exe) for this (obviously update the path and names as needed):

Code:
7z e hammerhead-MPZ44Q-preview-55d76d3a.tgz && 7z x hammerhead-MPZ44Q-preview-55d76d3a.tar

Mac and Linux Users
Using tar which is built in to OS X, open the terminal and you can extract using one command:

Code:
tar -zxvf hammerhead-MPZ44Q-preview-55d76d3a.tar.gz

Below is what you should see once you have files extracted.
Screen Shot 2015-06-03 at 9.17.43 PM.png


Step 4 – Reboot bootloader and flash
Assuming that you have fastboot and adb already set up and ready to use, just follow the commands below in order.

Code:
adb reboot bootloader

This will restart your phone into the bootloader mode. This will only work if your phone is connected and you have USB debugging turned on.

Code:
fastboot oem unlock

If your phone is already OEM Unlocked, you would not have to do this, but it wouldn’t hurt if you are unsure.

Code:
bash flash-all.sh

This will run all of the fastboot commands needed for the complete image flash. If you are using Windows, rather than a bash script you will use the flash-all.bat (batch) file. One common issue for running fastboot, regardless of your OS, not working is that you do not have fastboot setup properly and is not set as an environment variable (a variable that works system wide).

Windows users
There are reports from some Windows users that the flash-all.bat fails. It seems that it’s a bug with the fastboot.exe and how it inefficiently allocates memory. Some users say to try a different usb port or different usb cable, which they claim doing so solved their issues. If this works for you, please let us know in the comments below. Otherwise, please follow the workaround below that KingofPing has provided that will most likely solve your issues. What this does is break down each step manually that the batch file should have automatically done for you. (if you open the batch file in a text editor, you will see these same commands)

Make sure you extract the zip file in your directory that you extract it and place it’s contents in your working directory.

After flash-all.bat errors out, please follow these instructions:

—Don’t “press any key” – that will close the window – just hit Ctrl-C.—

fastboot flash boot boot.img
fastboot flash cache cache.img
fastboot flash recovery recovery.img
fastboot flash system system.img
fastboot flash userdata userdata.img

That’s it!
Once the scripts finish it will do a final reboot and the only thing left is to complete the normal Android setup wizards and enjoy. If you have any issues feel free to comment and we will help you out as needed!

Get Involved
If you are testing on your device make sure you help the Android community out and post any bugs you find. You can share your experiences here, or join the Dev community over on G+ to stay involved.

> Report Android M Issues > Android M Developer Community

src: How to install Android M on the Nexus 5, 6, 9, and Player
 
  • Like
Reactions: RA_BH

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones