This document contains step-by-step instructions for some common Android management tasks.
All the instructions have been tested with a Google Nexus 6 phone running Android 6.0/MRA58N and 6.0.1/MMB29K.
The basic prerequisites for all tasks are:
- On computer: Android SDK installed, and
android-sdk/platform-tools
inPATH
- On phone: USB debugging enabled (Settings > Developer Options)
Boot Into Bootloader Mode
Notes:
- Bootloader mode is a graphical menu provided by the bootloader
- A.k.a fastboot mode (because possible to run
fastboot
commands from computer)
Variant 1:
- USB-connect phone to computer
- On computer:
adb reboot bootloader
Variant 2:
- Turn off phone
- Press and hold power + volume-down
Boot Into Recovery Mode
Note:
- This is the recovery program, either the default one, or an alternative one (e.g. TWRP)
Variant 1:
- Boot into bootloader mode (see above)
- In the bootloader menu on the phone, select RECOVERY MODE
Variant 2:
- On computer:
adb reboot recovery
Unlock Bootloader
Note:
- This will factory reset the phone
Steps:
- In Settings > Developer Options, enable OEM unlocking
- USB-connect phone to computer
- Boot phone into bootloader mode (don’t select any menu item)
- On computer:
fastboot oem unlock
(on newer devicesfastboot flashing unlock
) - Follow instructions on phone screen
- Reboot (the now factory-reset) Android
Install a Custom Recovery (TWRP)
Prerequisite:
- Unlocked bootloader
Note:
- There are two main alternative recoveries, TWRP (TeamWin Recovery Project) and CWM (ClockworkMod ROM Manager), but TWRP is the simpler one
Steps:
- Download the device-specific TWRP image (file
twrp*.img
) from https://twrp.me/Devices/ - USB-connect phone to computer
- Boot phone into bootloader mode (don’t select any menu item)
- On computer:
fastboot flash recovery <twrp*.img>
- In bootloader menu on phone, select RECOVERY MODE
- This boots the newly installed TWRP
- It is important to boot TWRP a first time before rebooting Android. Because on the first boot, TWRP will patch the stock ROM to not automatically replace TWRP with the stock recovery.
- Reboot Android
On the first boot of TWRP, there might a dialog asking “Keep the system partition read-only?”. Selecting “Keep read-only” prevents TWRP from modifying the system partition /system
. This has some advantages regarding automatic Android updates. However, it prevents TWRP from being sticky, because in this case, TWRP cannot prevent the operating system from overwriting TWRP with the stock recovery on the next boot. The “Keep read-only” option can also be found in the Mount menu item of TWRP.
Install a Custom Kernel
Prerequisite:
- Custom recovery installed (we assume TWRP for the below instructions)
Steps:
- Copy the ZIP file of the desired kernel to the external storage of the phone
- Boot into recovery mode (TWRP)
- In TWRP, select Install, locate kernel ZIP file, and confirm installation
- Reboot Android
Install SuperSU
Prerequisites:
- Custom recovery installed
- Possibly, custom kernel installed (e.g. for Nexus 6 with Android 6.0 MRA58N)
Note:
- This “roots” the phone, i.e. installs the
su
command (in/system/xbin
)
Steps:
- Copy the ZIP file of the desired version of SuperSU to the external storage of the phone
- Boot into recovery mode (TWRP)
- In TWRP, select Install, locate SudoSU ZIP file, and confirm installation
- Reboot Android
The step of installing a custom kernel before installing SuperSU (or installing both at the same time) might be very important. Without a custom kernel, SuperSU might cause a “Device corrupt” boot error on the next boot of Android, which can only be remedied by flashing a factory image onto the phone.
Flash Factory Image
Prerequisite:
- Unlocked bootloader
Notes:
- This replaces the entire content of the hard disk with an “out-of-factory” image
- Lets the bootloader unlocked
- Removes the custom recovery
- Factory images for specific phones are provided by the phone manufacturers
- For Google Nexus phones see https://developers.google.com/android/nexus/images
Steps:
- Download the desired factory image and unzip it
- USB-connect phone to computer
- Boot into bootloader mode
- On computer: in the unzipped factory image directory execute
flash-all.sh
- That’s it. When done, the phone will reboot automatically