Android 4.3 was officially unveiled and released today to the Android Open Source Project. In a surprisingly timely fashion, Google also released both the factory images and OTAs to the Nexus 4, 7, 10, and the Galaxy Nexus.

In this post, I will show you how to easily update your Nexus 4 to Android 4.3 JWR66V without losing data or needing root, whether because you are having trouble flashing the OTA, because one is simply not available to you yet (these notoriously take weeks to propagate to everyone), or because you're running something else and want to return to stock. You can root your Nexus 4 in the last step if you want.

wm_Screenshot_2013-07-24-16-11-21 wm_Screenshot_2013-07-24-16-28-21 wm_Screenshot_2013-07-24-16-30-36

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

Prerequisites

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. You will also need a MicroUSB cable to execute adb sideload, fastboot flash, and other commands. You don't need a USB cable if you're just planning to download the OTA zip directly to your device and flash it from recovery.

Note #1: You will not lose your data in either scenario. The first one is the same as applying the OTA. In the second one, we'll skip wiping data and upgrade just the bootloader, radio, kernel, and system images manually.

Note #2: You will be able to easily gain root in the last step.

Scenario 1

In this scenario, you're running Android 4.2.2 JDQ39 and haven't modified the system files, which basically means you can cleanly apply the OTA update. I flashed the leaked 4.3 earlier, along with its bootloader and radio, then restored back to 4.2.2 and tried to upgrade using this OTA method, but failed. Therefore, I had to use scenario 2. However, most of you will probably be fine with scenario 1.

In order to avoid repeating the steps, download the official JDQ39->JWR66V OTA zip from here and then adb sideload it by following Section A or B in the guide here. If something fails, like it did for me, proceed to Scenario 2.

Update #1: JDQ39E->JWR66V.

Update #2: JWR66N (leak)->JWR66V.

Note: To flash the update via adb sideload, you don't need to unlock the bootloader and have your data wiped if yours is still locked .

wm_20130724_153942

adb sideload is painless and fast

Scenario 2

Scenario 2 is what I would call plan B. You're here because the OTA failed, you screwed up your device and it's not booting, you're not on 4.2.2 JDQ39, or you're running a custom ROM. Don't worry - you won't lose data, even though the default factory image installation method (the bundled flash-all script) does wipe it.

The idea of this method is:

  1. Download the full occam factory image, which includes the full system, bootloader, recovery, kernel (boot.img), and radio. It's a clean slate for these components - they'll flash cleanly over anything you have now.
  2. Instead of using the bundled script called flash-all, you will unpack the tgz (tar/gz) archive, and then the zip contained within as well. This will put all the components into one folder:
    image
  3. Follow the excellent guide over here and make sure to omit step D10, which overwrites userdata. Here are the commands you will be executing, for reference:
    adb reboot bootloader
    fastboot flash bootloader bootloader*.img
    fastboot reboot-bootloader
    fastboot flash radio radio-mako-m9615a-cefwmazm-2.0.1700.84.img
    fastboot reboot-bootloader
    fastboot flash system system.img
    fastboot flash boot boot.img
    fastboot format cache
    fastboot reboot

Note: Instead of unpacking the image*.zip and flashing system and boot manually, you can actually do fastboot update image*.zip - this won't delete data (you would pass a -w flag if you wanted that to happen), but it will re-flash recovery back to stock if you were running a custom one. You can then flash it back, or just use the commands above instead. Either way, the result will be the same.

wm_20130724_155140

Bootloader in fastboot mode

Rooting

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

  1. Flash TWRP from here (fastboot flash recovery FILENAME.img).
  2. Reboot into recovery (adb reboot recovery or hold Power+VolDn, then select Recovery).
  3. Flash SuperSU from this post. I've seen 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. It's certainly done it for me on both the 4.3 leak and the factory flash from scenario 2.
  4. You should be rooted.

Enjoy 4.3 and don't forget to see what's new!