This week, Google announced Android M during the keynote on opening day of Google I/O. Along with a few other things. Like last year, Google is doing a developer preview of the new operating system, and anyone with a Nexus 5, 6, 9, or Nexus Player can install the Developer Preview and use it. It's important to remember that the Developer Preview is going to be pretty buggy, it's called a "preview" for a reason. This year, however, Google is going to be updating it more often and doing over-the-air updates. Last year with Android L we were forced to flash the new preview when they became available.
So how do you flash the developer preview? Well first you'll need to install the Android SDK, you can install it on Windows, Mac OS X or Linux. Next up, you'll need to download the appropriate factory image for your device. It's a good idea to unzip it and place it in the "platform-tools" folder in the SDK, as you'll be using that folder in terminal or command prompt.
NOTE: For OS X users, you will need to add a "./" to the beginning of these commands for them to work.
Now that you have the SDK installed and the image downloaded. You'll need to open up a command prompt or terminal window and navigate to where you've installed the SDK. For instance, on Mac OS X, it'd be something like this "/Users/username/Desktop/android-sdk-macosx/platform-tools/". Once you've navigated to the appropriate folder, the next step is to plug in your device. Once it's plugged in and USB debugging is turned on in developer settings, run the command "adb devices" to be sure that your device can be seen. You may see it say "offline", that's an easy fix, just go to your device and select OK on the dialog box. If your device shows up you are set and ready to go. If not, you may need to change from MTP to PTP, or you may need to switch USB cables.
Next up, we're going to run the command "adb reboot bootloader", that basically just reboots your phone into bootloader mode. If your bootloader is not unlocked, you'll need to run "fastboot oem unlock" next, if it is unlocked, then you can skip that part. Now it's time to start flashing all the things. Google says that you can just execute the flash-all file that's located in the image you downloaded, however that didn't work for me. So below, we'll show you how to flash each part of the image.
Here we'll be using the file names for the Nexus 6, so if you are flashing it on the Nexus 5, 9 or Nexus Player, just simply change the file name to the file you have. We're going to run the command "fastboot flash bootloader bootloader-shamu-moto-apq8084-71.11.img" this will flash the bootloader and update it. It should take just a few seconds. Now type in "fastboot reboot-bootloader". Next, run the command fastboot flash radio "radio-shamu-D4.01-9625-05.16+FSG-9625-02.94.img" as you guessed, that flashes the new radio for the device. Again we're going to do "fastboot reboot-bootloader".
Now here's the big part, you'll need to unzip the image-shamu-MPZ44Q.zip. And then we'll flash the system.img by running the command "fastboot flash system system.img". Once again, reboot bootloader with the "fastboot reboot-bootloader" command. Finally we're going to flash the boot.img file, by running the "fastboot boot boot.img" command. Now reboot your device.
Once you've flashed everything it may take a few minutes for the device to boot up, so don't worry. But once it does, you'll have Android M on your Nexus device.