The great Nexus 7 ordeal of 2013 is now over after Qualcomm apparently agreed to the release of the factory image and all necessary drivers, only a day after lots of hubbub had been made about this touchy and unpleasant situation. Awesome, so now we have access to the factory image, meaning we can restore the tablet back to stock no matter what happens to the software on it.

Say, you had a bad flash and are now boot-looping. Or your dog installed a custom ROM but Android 4.99 came out and you want to update ASAP. This is where this guide is going to come in handy. The instructions aren't any different from the usual factory image installation procedure but they apply specifically to the 2013 Nexus 7, so you can rest assured you're not following some generic guide that may not work on your device. Additionally, I've seen many variations of the steps necessary to preserve your data, and I think this is the most optimal way to go.

Note #1: If your bootloader is locked, your data will be wiped for security reasons - there's no way around that. You will want to back up what you want manually.

Note #2: If your bootloader is already unlocked, you have the option of skipping the data wipe during the factory image flashing procedure. In some situations, not wiping user data may prevent the Nexus 7 from booting, in which case you'd probably need to go ahead with the wipe, but for simple OS upgrades from one version of stock Android to another one higher, wiping data should not be necessary.

Note #3: You can root your Nexus 7 in the last step if you want.

Disclaimer: Android Police isn't responsible for any harm to your device - proceed at your own risk.


In order to complete the steps below, you need to have the Android SDK installed. The SDK contains the latest version of adb and fastboot, which you will need for flashing files and issuing commands. You will also need a MicroUSB cable to execute adb sideload, fastboot flash, and other commands. You also need to unlock your bootloader - a process that wipes your data.

Enable Developer options by going to the Settings -> About screen and tapping Build number until the OS unlocks the hidden Developer options menu. Now go to Developer options and make sure you have USB debugging turned on. For security purposes, you can turn it off after we're done.

To unlock the bootloader, if you haven't already done so:

  1. Reboot into the bootloader by issuing an adb reboot bootloader command on your computer or holding VolDn+Power while booting (power off, hold VolDn, then hold Power).
  2. Warning: This will wipe your data. Type in fastboot oem unlock on your computer. Agree to the unlock by selecting Yes on your tablet (VolUp, then Power).
  3. You have now unlocked your bootloader (and the data partition was wiped clean). Verify by rebooting to the bootloader again and looking at Lock State.


The Steps

  1. Download the full factory image corresponding to your exact model (for example, 2013 Nexus 7 Wi-Fi is razor), which includes the full system, bootloader, recovery, kernel (boot.img), and radio (radio not included for Wi-Fi-only variants). It's a clean slate for these components - they'll flash cleanly over anything you have now.
  2. Unpack the tgz (tar/gz) archive into its own directory. I use Total Commander, but you can use any tool that reads gz and tar, like 7-Zip:
  3. Proceed with this step if you want to keep your data intact. If you skip this step, your data will be wiped. With your favorite text editor, edit (be careful not to run it by accident instead of editing) flash-all.bat (if you're on Windows) or flash-all.sh (Mac, Linux) and remove "-w" from the fastboot update command. For example, if the line reads fastboot -w update image-razor-jss15j.zip, it should now read fastboot update image-razor-jss15j.zip. The -w option instructs fastboot to wipe data.
  4. Reboot into the bootloader and run the appropriate flash-all script:

8-9-2013 5-20-09 PM

That's it, you're done. In my case, the Nexus 7 is now running stock Android 4.3:


Note: The above procedure restored the factory recovery, so if you want a custom one, you can flash one now (see below).

For better security, you can relock the bootloader by issuing fastboot oem lock while booted to the bootloader. This will, however, mean that if you ever want to do anything that requires an unlocked bootloader, you will lose your data in the unlock process.


Rooting a Nexus 7 is very easy. It requires an unlocked bootloader and a custom recovery. I recommend using TWRP.

  1. Flash TWRP from here (Reboot into the bootloader as before and then fastboot flash recovery FILENAME.img).
  2. Reboot into recovery (adb reboot recovery or hold VolUp and Power while booting).
  3. Flash SuperSU from this post. To do that, download the zip, then put the recovery into adb sideload mode (in TWRP, it's under Advanced), and then do adb sideload FILENAME.zip. I've seen some people complain that doing so via CWM doesn't work, but flashing through TWRP and selecting Fix Superuser Permissions at the end does the trick.
  4. You should be rooted.
  5. Reboot, head to the Play Store, and update SuperSU.


Artem Russakovskii
Artem is a die-hard Android fan, passionate tech blogger, obsessive-compulsive editor, bug hunting programmer, and the founder of Android Police.
Most of the time, you will find Artem either hacking away at code or thinking of the next 15 blog posts.

  • Haveandhavenots

    So basically, we can keep our data during the flashing procedure, by editing flash-all.bat, but before that one of the "Prerequisites" was to first unlock the bootloader, and that "will wipe your data".

    So, either this is an exercise in futility, or it was confusingly written.

    Did the autor wanted to say - you can keep your data, buit only if your bootloader is already unlocked?

    Or did he wanted to say that unlocking the bootloader is not required, but optional?

    • http://www.androidpolice.com/ Artem Russakovskii

      Yes, the unlocked bootloader is a prerequisite. You can keep the data using the factory image flashing procedure itself only if you're already unlocked.

  • fjleon

    Never heard of this method before, i have always just used fastboot from the computer to flash bootloaders, system images and radios

    • http://www.androidpolice.com/ Artem Russakovskii

      The flash-all script that comes bundled with the factory images does just that, just take a look at the code.

  • nsnsmj

    I'd just like to say the reaction by some people on the internet to the factory image thing is/was an embarrassment. It really drives home the stupid idea that Android users are a bunch of Angry nerds.

    People knew what happened with the Nexus 4, and knew it was because of Qualcomm's intellectual property that things were being held up, yet they bitch and complain at people who have no real control over the situation. Google can't force a chip vendor (or any other company) to release anything they aren't legally obligated to do, or anything else they don't want to. They don't have to release factory images at all as far (as far as I'm aware, correct me if I'm wrong), so people need to shut the hell up and learn to be patient, and realize you aren't owed anything.

    Hacking, tinkering, and all that jazz is not a right, it's not a given, especially in regards to software. People forget that Google is even allowing them to make gapps packages for flashing on custom ROMs. They post factory images for you people who enjoy custom ROMs to be able to return to stock firmware in case something goes wrong. These things are taken for granted, and all the idiotic nerd rage on the internet is not helping anything.

    And don't get me started on the Moto X nonsense. The amount of stupidity I've seen on the internet regarding that is insurmountable, and just as embarrassing.

    Anyway, just my opinion.

    • Carlos Rodríguez

      I kinda agree with you, but we're talking here about a Nexus device.

      A Nexus is the pinnacle of AOSP which in fact ship with an unlockable bootloader and technically is a developer unit where people test their apps to be deployed in all the ecosystem. It is expected to be hacked/flashed.

      Yes, the same happened with the Nexus 4 but I think JBQ was pissed off then and couldn't handle it anymore now.

      Also, if you (Qualcomm) are selected to manufacture the SoC for a device of this kind, you should be aware that this situation will happen.

      I know, Qualcomm is not "obligated" to release anything (in I'm not mistaken), but for the sake of AOSP and the "freedom" of Android itself, you should be able to restore your device to stock no matter what. Also, they're not losing anything by releasing binaries. Nobody can do anything to a binary unless they reverse engineer them and they could do the same with a system dump.

      HTC offers their RUU to their unlocked carrier-free devices. I don't see the reason why Google shouldn't. Samsung has samfirmware (not actually related) to host their firmware files. LG does the same and so on.


      • nsnsmj

        I understand, I was just getting tired of all the constant whining and complaining that seems to be a normalcy these days. It gets tiresome, but hey, I guess that's the internet for ya.

        Cheers, :)

  • anzensepp1987

    I want Android 4.99! Now! ;)

  • digidude

    After I flashed TWRP, I started to reboot and got a "system is going to lose root" message, which asked if I wanted to fix it. I told it to go ahead by swiping the appropriate dialogue. Got stuck in a bootloop for 10 minutes. Pressed power until it shut off, and went back into TWRP (which meant it was there - good!). Wiped system and got a "fail" message. Twice. Once I rebooted, though - it told me that SU was only partially installed, and I needed to go to the Play Store to update. I did -- BUT I think the backup settings screwed with my IP address, since halfway through - the connection was lost and couldn't reconnect. So I backed out and tried it through TWRP (which was the other possibility on the SU update screen). No dice. I thought I was screwed, but since I could get back into TWRP, I did another wipe, and sideloaded the SUupdate file through ADB. I let that run then fixed permissions (just for good luck) - wiped again with a "success" message - then rebooted. BOOM. Superuser was fully installed, root achieved. Moral: Don't freak out if it doesn't work perfectly for you. Just go back through the steps logically.

  • edward

    I click flash all and it says that fastboot is a bullshit command press any key to exit.

    • Dimitris Klimis

      In Windows, you'll have to add the path that has adb and fastboot executables to the system environmental variables. This will help the .bat script to use the executable without it having to be on the same folder. First locate fastboot.exe by doing a normal windows search. Copy the path that the executable is found in. Follow this guide to add the path of the executables to the PATH system variable http://www.computerhope.com/issues/ch000549.htm. Make sure not to delete the old ones but just add the new one to the end.

  • Aaron Scheiwiller

    I did exactly what stands here and my command line looks identical with the one in step 4, but i have still bootloop. I only unlocked it sucessfull and flashed the latest SuperSU then it got stuck and i tried to restore it like it stands here. Someone any idea what to do?

    • Hi Hisson

      Try using a toolkit...

      • http://www.kcmartz.com/ Kcmartz

        Yep the NRT is a great tool!

  • Holman Calderón

    Now my nexus doesnt start, it doesnt even appear the charging icon when I connect it, I need help!

  • Holman Calderón

    I made it ike the post, but now my nexys doesnt turn on and the charging icon doesnt even appear, I need help, thank you

  • tt

    in my update-all.bat script there is "fastboot erase userdata" will it erase all my data? Should I remove it?

  • aaa
  • PG Gabor


  • 2014

    Can I unlock bootloader without wiping data?

    • Anthony

      if you read the article right at the top it says "Note #1: If your bootloader is locked, your data will be wiped for security reasons - there's no way around that. You will want to back up what you want manually." next time read before posting

  • Nonamus


    Actually this method DID ERASE all user data.

    deleting '-w' from flash-all.bat didn't help.

    I performed it using 4.4.2 (KOT49H)

    My data :'(

  • Tom

    had a hard time getting it working. I was missing entries in "/etc/udev/rules.d/51-android.rules"

    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0666", OWNER="your user name here" # 8GB version
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e44", MODE="0666", OWNER="your user name here" # 16GB version
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0666", OWNER="your user name here" # Bootloader
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d001", MODE="0666", OWNER="your user name here" # Recovery

    After i edited the file it worked as discribed

  • Matt

    Is there a way to relock the bootloader without a PC (on an unrooted nexus 7)? My device was rooted, I accidentally updated to 4.4.4, never relocked, and now the device USB doesn't work and I can't connect to the PC. Any tips how to relock so I can send in for warranty repair?