How to Root Pixel 4 / 4 XL [Guide]
Back in the Android KitKat days, rooting was deemed to be somewhat of a necessity. OEM-provided software lacked a lot of key features we take for granted today such as a flashlight button and battery percentage indicator. There are still several benefits to rooting, but the cons outweigh the pros. Once rooted, you won't receive updates OTA anymore, so you'll have to manually sideload them every time. Additionally, some banking apps and services such as Google Pay may not work as well. XDA Developers is a treasure trove of resources and will save your life on several occasions, so be sure to visit it often. If you're looking for a rooting guide for the Pixel 4, you're probably already aware of the risks, so without further ado, let's get right into it.
How to root the Google Pixel 4 and Pixel 4 XL with Magisk
Step 1: Find out your devices' build number. To do that, you need to head over to Settings> About Phone and look for a tab that says Build Number. It should look something like "QD1A.190821.014." and may change depending on your model. While you're here, tap on it several times to enable Developer Options, as you'll be using that quite often.
Step 2: Download the factory images for the Pixel 4 and Pixel 4 XL using the included links. It is essential that you download the image corresponding to your build number, or else can risk bricking your device.
Step 3: Open the factory image from your PC/Mac and Next, look for a file that looks like, "image-devicecodename–version.zip" where devicecodename is 'Coral' for the Pixel 4 XL and 'Flame' for the Pixel 4 and version is your build number from Step 1. Open the aforementioned zip and look for a 'boot.img' file. Transfer this boot.img file to your phone.
Step 4: Download and install the Magisk Manager APK using this link. Open it and click “Install” button next to the “Magisk is not installed” text. Select “Install” then “Select and Patch a file.” Navigate to the boot.img file from the previous step and select that in Magisk Manager. Magisk will then patch the boot image and save a file called “magisk_patched.img” in your Downloads folder. Copy this file back to your PC and keep it at a convenient location, as we'll require it later.
Step 5: Unlock the bootloader by following the steps detailed in this post. The process will wipe all of your on-device data, so make sure that you have your data backed up.
Step 6: Restart your phone and head into the Bootloader menu by holding down the power and volume up rocker. Connect your phone to your PC/Mac via a USB cable and open a command prompt/terminal in the folder where you have ADB/Fastboot downloaded. Type in "adb devices" and ensure that your device shows up before proceeding. If it doesn't, you have to boot into Android, navigate to Developer Settings and enable "USB Debugging" from there.
Step 7: Type "fastboot flash boot path/to/magisk_patched.img" in the command prompt/terminal. Here path/to is the location of the “magisk_patched.img” from step four. For example, if you have it saved in C:/Downloads, the command will look like "fastboot flash boot C:/Downloads/magisk_patched.img" The process is near-instantaneous and should take less than a minute.
Step 8: Reboot your phone by either holding down the power button or typing "fastboot reboot" in the command prompt window. Your phone will be rooted with Magisk. The Magisk Manager app should appear on your home screen automatically. If it doesn’t, you'll have to install the APK manually.
That's it, your Google Pixel 4 is now rooted with Magisk. You can now install a host of Magisk Modules to further customize your Android experience. Do note that you'll have to manually sideload every update, as you won't be getting them over the air anymore. You'll have to perform steps one, four and seven every time there's a software update for the Pixel 4.