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)
Below are direct links to download the Android M preview images. Please make sure you download the correct one to avoid any major issues.
All of the necessary image files that you will need are located in this “tgz” compressed file.
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):
7z e volantis-MPZ44Q-preview-d15ad483.tgz && 7z x volantis-MPZ44Q-preview-d15ad483.tar
Using tar which is built in to OS X, open the terminal and you can extract using one command:
tar -zxvf volantis-MPZ44Q-preview-d15ad483.tar.gz
Below is what you should see once you have files extracted.
Depending on which device you are flashing, you may see slightly different files. For example, the Nexus 6 (shamu) will contain a zip file and an extra radio file. The batch script will also have a few differences from lets say, the Nexus 9 (volantis). On Windows if you are flashing the Nexus 6… please pay extra attention to the Update for Windows users below.
Assuming that you have fastboot and adb already set up and ready to use, just follow the commands below in order.
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.
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.
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 of this 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).
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 that if you have an extra 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
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!
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 over at AndroidForums.com, or join the Dev community over on G+ to stay involved.
> Report Android M Issues > Android M Developer Community