[General Topics] naman14:
ALL DATA WILL BE LOST , BACKUP EVERYTHING

I RECOMMEND USING TWRP CUSTOM RECOVERY

Getting started

In order to root Android 4.2 the following three requirements must be satisfied beforehand:

The Android SDK, which you can download from Google Developers

A custom recovery like ClockworkMod (CWM) or Team Win Recovery Project (TWRP)

SuperSU, which you can download from CF-Root

There are no major differences between the two, but TWRP is more touch-oriented thanks to larger buttons. CWM is also available in a touch-compatible variant, but it has much smaller buttons. It's a matter of personal preference between the two though, but you have to choose one.

Before starting the process I urge you to perform a backup, as all data might be lost afterwards. You can copy the contents of the SD card to a safe external location such as cloud storage service or computer hard drive.

Setting the Stage

The first step that needs to be performed after all the files are downloaded is to install the Android SDK. Afterwards open the Android SDK Manager and select the following two items:

Android SDK Platform-tools -- it contains the required programs to install Android 4.2 Jelly Bean

Google USB Driver -- it contains the necessary drivers for the Nexus device

Then you should create a folder in an easily accessible location within the command line. In this example I will use a folder named "Root" in my C:\ drive in Windows. The path name will therefore be: "C:\Root".

From the folder where Android SDK Platform-tools is installed (in my case it is "C:\Program Files x86)\Android\android-sdk\platform-tools") copy the following files to the previously created "Root" folder:

adb.exe

AdbWinApi.dll

AdbWinUsbApi.dll

fastboot.exe

The following files must also be copied to the "Root" folder:

CWM-SuperSU-v0.97.zip -- SuperSU file

The custom recovery that you previously downloaded for your specific device (please see below)

For my Samsung-made Google Galaxy Nexus (codename "maguro") I will use TWRP with the name "openrecovery-twrp-2.3.1.0-maguro.img".

Depending on your device the name of the file that you must copy may differ.

In order to make the process smoother for instance the SuperSU file can be renamed to "root.zip" and the custom recovery to "customrecovery.zip". It's a matter of convenience, but for accuracy I will stick to the original naming for this guide.

If the previous steps are completed you must have the following six files in your "Root" folder:

adb.exe

AdbWinApi.dll

AdbWinUsbApi.dll

fastboot.exe

CWM-SuperSU-v0.97.zip -- SuperSU file

The custom recovery. In my case it is "openrecovery-twrp-2.3.1.0-maguro.img"

From there, you can proceed to install the drivers for "fastboot mode". To install them, follow these steps:

Power off your Nexus device.

Press and hold Volume Up and Volume Down then press and hold the Power button; the device will now enter "fastboot mode".

Go to Device Manager (Computer -> Properties -> Device Manager in Windows 7/8) and identify the device; for me it shows up as Android 1.0.

Right click Android 1.0 and select "Update Driver Software," then select "Browse my computer for driver software".

Select "Let me pick from a list of device drivers on my computer," then click "Next".

From "Have Disk..." option go to the folder where you have Google USB Driver installed (for me it's "C:\Program Files .(x86)\Android\android-sdk\extras\google\usb_driver") and select "android_winusb.inf".

Out of the three options select "Android ADB Interface" and validate any future warning window to install the driver.

Final preparations

Everything is prepared in order to start the installation process, but in order to do so a command window must be opened. Windows Key + R opens "Run"; type in "cmd" and the command window appears. Typing "cd C:\Root" and pressing Enter sets the "Root" folder as the working directory. Pressing the Shift key and right clicking inside the "Root" folder will also deliver the same result.

The device must be turned on in "fastboot mode" which I have explained at step no.2 during the driver installation process, and obviously plugged-in to the computer. You then have to type in the following commands while in "fastboot mode":

fastboot devices -- this is just for verification purposes; if there is no listed device then the drivers have been improperly installed and steps 1 through 7 must be redone.

fastboot oem unlock -> you have to accept the prompt in order to continue -- this command will unlock the bootloader, but it will also erase the data on the device which is why a backup is necessary.

fastboot reboot-bootloader -- this will reboot the bootloader.

fastboot flash recovery openrecovery-twrp-2.3.1.0-maguro.img -- this will flash the custom recovery --please use the specific file and name for your particular Nexus device!

fastboot erase cache -- this will erase the cache -- might not be necessary but it's just as a precaution.

fastboot reboot -- this will reboot the device.

After Android 4.2 is loaded and running the SuperSU file must be copied from the "Root" folder to the internal storage (shows up in Windows Explorer as a Nexus device). A simple copy and paste will do the trick here.

Then you have to power off the Nexus device and enter "fastboot mode" again. Use the Volume Up and Volume Down keys to navigate until you can select "Recovery Mode". After the power button is pressed the device will reboot in the new custom recovery.

Rooting your Nexus device

If you have ClockworkMod installed, you have to perform the following steps:

Select "install zip from sdcard"

Select "choose zip from sdcard"

Select "0" (zero) folder

Select "CWM-SuperSU-v0.97.zip"

Select "Yes - Install CWM-SuperSU-v0.97.zip"

Select "Go Back"

Select "reboot system now"

If you have Team Win Recovery Project installed, you have to perform the following steps:

Press "Install".\

Select "CWM-SuperSU-v0.97.zip" -- for me it's in the "0" (zero) folder

Swipe to confirm flash

Press "Wipe cache/dalvik" (just as a precaution)

Swipe to wipe

Press "Reboot System"

After Android 4.2 loads your device can run apps with elevated privileges (meaning it's rooted). A SuperSU app is installed in order to allow root requests, so please use your judgement on which apps you grant access.