Since the beginning of Android as one of the best mobile operating systems, developers and users alike have been looking for ways to extract the most out of their devices. This is important because smartphone manufacturers are known to lock down several aspects of the hardware to offer better security and stability for general users.
One of the several ways to enhance the performance of Android devices is to enable root access. In this article, I will explain in detail how to root your Android device.
Table of Contents
What is rooting?
Rooting is the process of allowing the users of Android operating system privileged access to the device’s subsystems. This is similar to superuser access in Linux. With root access, you can overcome restrictions that manufacturers and carriers put on your device. This means you can modify almost every aspect of your Android device by altering the system files, running root-specific apps, etc. Essentially, you can perform tasks that are otherwise inaccessible to normal Android users.
Advantages of rooting Android
With the special access you get by rooting your Android device, you can perform several things that you would otherwise not be able to do, a few of which are:
- Uninstalling system apps (pre-installed apps) that cannot be removed normally.
- Blocking advertisements from appearing on installed apps and games.
- Overclocking or underclocking the CPU to control the device’s performance.
- Changing the default bootanimation.
- Installing some of the best root apps that do cool things.
Disadvantages of rooting Android
Although rooting opens up lots of new options, it comes with some drawbacks too.
- Most manufacturers will void your warranty if you root your device.
- Elevated permissions to the user means your data is more accessible to malicious apps.
- The rooting process can leave your device useless if not done correctly.
- Certain apps, such as Google Pay, that require a secure environment don’t work on rooted devices.
- Most manufacturers don’t push OTA updates to rooted devices.
It is important to note that you don’t need root access to install a custom ROM on your Android device.
Is it safe to root your Android device?
Rooting Android is a double-edged sword. While rooting opens up a world of possibilities on your Android device, the added privileges can backfire if not well taken care of.
Android by design is very secure. Unlike Windows, where most of us use administrator accounts, Android by default offers you a profile that is stripped-down to perform non-administrator level tasks. This means apps running on Android don’t have access to root.
By rooting your Android device, you are opening up your operating system as well as sensitive data to potentially malicious apps. Some malware apps specifically target rooted devices to infect system-level files. So you need to be careful what you install.
On a rooted Android device, you’re essentially taking over the security of your device in your hands and forcing Google to take the backseat. If you’re not tech-savvy and don’t know how to troubleshoot, it’s better you drop the idea.
Is rooting illegal?
Rooting in general is not illegal in most of the countries. However, it goes against the manufacturer’s terms and conditions in most cases. They don’t like the fact that when users root a device, they lose control over it.
Thankfully, these days quite a few developer-friendly manufacturers are allowing users to retain their warranty even with a rooted device.
Important:
- This is a generic guide, which means that these are the steps that apply to most Android devices. It is advisable to cross-check them with the rooting thread for your device on the XDA Developers forums.
- Read this tutorial on your computer so that the steps and commands are easy to follow.
- If you’re in doubt at any point, stop. Check for other guides online to see if they can answer your queries before proceeding. Otherwise, you can always put in a comment here although it means you have to wait for my response, which can take some time.
So, let’s get started.
Prerequisites
Before you start with the process, make sure you have the prerequisites in place.
- Your Android device: Fully charge your device.
- PC/Laptop: It should be in a perfect working condition. Sudden freezes and reboots can get you into a problem.
- USB data cable: Preferably the original cable that came with your device.
- Android SDK Platform-Tools: Download the latest files to your PC/Laptop.
- Custom recovery: Download the latest TWRP for your device on your laptop.
- Magisk: Download the latest version of Magisk from here on your laptop.
How to Root your Android Device using TWRP
There are several ways of rooting an Android device. Also, the steps for rooting can vary from one device to another. There’s the tried and tested method of rooting a device via a custom recovery as well as the one-click-root methods that employ specific software to do the job. On newer devices, the recommended method is to enable root access by patching the boot image which I will explain in a post later.
One-click-root methods are not recommended anymore. They are not reliable anymore on the newer Android versions and often come packed with malware.
In this tutorial, I will explain how to root your Android safely using Magisk and TWRP (Team Win Recovery Project) custom recovery. I would recommend rechecking the exact steps for rooting your smartphone on XDA Developers forums.
First, you will need to prepare your PC and Android device for the rooting process.
Take a backup
Start with taking a complete backup of all the important data on your smartphone. This includes photos, videos, important files and app settings. This is important because all this data will be lost during the process.
To do this, connect your smartphone to your PC and transfer all the media. To backup your app settings, use cloud sync with your Google account.
Download Android SDK Platform-Tools
Download the Android SDK Platform-Tools on your PC. This package provides the ADB and Fastboot binaries and acts as a bridge that enables your Android device to connect with the PC in ADB and Fastboot modes.
Enable Developer options, USB Debugging and OEM Unlock
Step 1: To enable Developer options on your device, navigate to the path below.
Settings > About Phone > Build Number
On some smartphones, the path could be as below.
Settings > System > About Phone > Build Number
Step 2: Tap on the Build Number 7 times. You will get a prompt – “You are now a developer!”.
Step 3: Now you need to enable two more settings – USB debugging and OEM unlocking.
To do that, follow the path below.
Settings > System > Advanced > Developer Options
Look for the two items in the menu and turn the toggles on.
Now that you have prepared the systems, you have to unlock the bootloader on your smartphone, flash a custom recovery and finally flash Magisk for root access.
Unlock Bootloader
Step 1: Connect your smartphone to the PC via USB cable.
Step 2: Open the folder that has the Platform-Tools files and open Command Prompt. To do that, type cmd in the address bar of File Explorer and hit Enter. Alternatively, do Shift+Right click on an empty area of the window and select “Open command window here”.
Step 3: First, check if your device is able to communicate with the Android SDK. To do that, run the below command.
adb devices
It will return a device code under “List of devices attached”. If that doesn’t work, check if you performed the previous steps correctly. Also, make sure the USB cable is working.
Step 4: Now you need to boot your Android device into the bootloader (fastboot) mode. To do this, enter the command below and hit Enter.
adb reboot bootloader
Your device will now reboot and boot into bootloader mode. How it looks differs from one device to another, but usually, it is a black screen with an Android logo and some device information.
Step 5: Reconfirm that your device is still communicating with Android SDK using the command below.
fastboot devices
Step 6: To finally unlock the bootloader, run the below command.
fastboot flashing unlock
For some devices, the above command may not work. In such cases, use the one below.
fastboot oem unlock
You might get a confirmation prompt on your device. You need to select “Yes” using the volume up/down buttons and press the power button to confirm. If you don’t get a prompt and the unlocking starts automatically, don’t worry, it depends on the device.
The bootloader unlocking process will last for up to a minute for most devices.
Step 7: On completion of the bootloader unlocking, the device will auto-reboot back into fastboot mode. Run the below command to boot into the system.
fastboot reboot
During the reboot, your smartphone will be reset to its factory settings.
On some devices, you will see a warning that the device is in an unlocked state which is not secure. This is normal and nothing to worry about.
You will now have to set up your device as you do on a new smartphone.
Install Custom Recovery
You will now need to install a custom recovery on your Android smartphone. This is a mandatory step if you want to get root access to your device.
There are a few good custom recovery options such as TWRP and OrangeFox. In this tutorial, we will use TWRP as it is the most popular choice and has been around for a long time.
For most devices, the TWRP installer is just an image file. However, for some, it also includes a zip file. This tutorial will cover both, and you have to be very careful with the steps to avoid messing up the device.
Follow the steps below to install TWRP recovery.
Step 1: Enable Developer options and then enable USB debugging and OEM unlock by following the steps explained before. This is again needed because after the factory reset, these options are turned off by default.
Step 2: Rename the TWRP recovery image file to twrp.img and place it in the folder on your computer that contains the Platform-Tools files.
Place the TWRP recovery zip file in your smartphone’s internal storage, if applicable.
Step 3: Connect your smartphone to the PC via USB cable.
Step 4. Follow the steps explained before in order to launch Command Prompt in the folder once again.
Step 5: To reboot into fastboot mode, run the below command.
adb reboot bootloader
The device will now restart and you will again see the fastboot mode screen.
Step 6: To confirm that the fastboot mode connection between your smartphone and the Android SDK is working as expected, run the below command.
fastboot devices
If your device code shows up in the results, you’re good to proceed.
Step 7: Now install TWRP recovery on your Android smartphone using the below command.
fastboot flash recovery twrp.img
In most cases, this process will last a few seconds. Upon completion, you will see a success message in the Command Prompt window.
If your device’s TWRP installer is only an image file, the TWRP bootup will patch the operating system to prevent it from replacing the TWRP recovery with the stock recovery on the next device restart. This happens in the background so no action is needed from your side.
If your device’s TWRP installer consists of both image and zip files, you will need to follow a few more steps. The following steps are not applicable to you if the TWRP installer for your device consists of just the image file.
Step 8: On the TWRP home screen, tap on Install. This will open the file system.
Step 9: Select the TWRP zip file from the internal storage. A new screen will open to confirm the installation.
Step 10: Swipe across the screen at the bottom of the screen where it says “Swipe to confirm Flash”.
The flashing process will run for a few seconds and you will see a success message at the end of it.
You have now successfully replaced the stock recovery on your Android device with a feature-rich custom recovery and are one step away from enabling root access.
Flash Magisk
To install Magisk on your Android device, follow the steps below.
Step 1: Rename the Magisk .apk extension to .zip extension, for example, Magisk-v23.0.apk to Magisk-v23.0.zip. Place the file in the internal storage of your device.
Step 2: Reboot into recovery. There are two ways to do this.
If you’re still connected to your PC, run the following command in Command Prompt.
adb reboot recovery
Alternatively, press and hold the Power+Volume Up buttons (Power+Volume Down in some devices) for a few seconds. The device will restart and you will need to release the buttons when the device logo comes up. After this, you will be on the TWRP recovery home screen.
If this is the first time you’re booting into TWRP recovery after its installation, it may ask you to confirm whether to Keep System Read only. Swipe across where it says Swipe to Allow Modifications. Keeping the system read-only will prevent TWRP from making changes hence not recommended.
Step 3: Tap on Install on TWRP home screen. Select the Magisk zip file from the internal storage on the next screen. Lastly, swipe across the screen where it says Swipe to confirm Flash.
Install > Select Magisk package > Swipe to confirm Flash
Flashing Magisk will take a few seconds to complete, after which you’re ready to boot into the operating system.
To do this, go to TWRP home screen, tap on Reboot > System.
Reboot > System
Once your device has booted into the operating system, look for the Magisk app. If it isn’t installed automatically, manually install the APK file.
That’s it. Your device is now rooted and you can verify it using one of the several root checker apps from Google Play.
Now install some root apps and live the magic.
That brings us to the end of the tutorial. Most of the Android enthusiasts who have rooted their devices tend to flash a custom ROM as well for its added advantages. If you decide you want one, we have a list of the best custom ROMs, it will help.
I would love to know about your rooting experience, let me know in the comments.
Cheers!