Introduction
Ever wanted to fiddle with your Android emulator phone a bit more in-depth, but were afraid that something would break? No worries, this guide will teach you how to get full root access over your emulated Android phone.
What is root access?
Basically, root access is the highest level of access. Acquiring root gives you full control over what you can run, customize, and configure on your phone. That includes (full system access, running privileged apps, visual customization, file system access and much more). For instance, when there is a need to install some shady application which is not from your average Play Store, your phone will forbid that due to security reasons, but with root access, you can bypass these security checks and install whatever you want, no questions asked.
Usually, root access is not needed for an ordinary phone user and is mostly used by developers and advanced users for debugging purposes. Having said that, if you are reading this, I would imagine that you are no ordinary user and you have your reasons for rooting your phone. So let's dive into rooting.
Prerequisites
Before we begin, we will need to install a couple of things:
- Git for cloning repos
- Android Studio installed with the latest Android SDK, including SDK Platform Tools (adb)
- Basic knowledge of Android Debug Bridge (ADB) and command-line tools
- Command-Line Setup:
- Add Android SDK tools (adb, emulator) to your PATH on macOS/Linux
- For macOS (Zsh/Bash): Update ~/.zshrc or ~/.bash_profile, then run source ~/.zshrc or source ~/.bash_profile
- Verify setup with adb --version and emulator -list-avds in a new terminal
export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
export PATH="$PATH:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/emulator"
1. Create a new device in Android Studio
First and foremost, we need to create a device which we are going to root. Click on the more actions menu and then on Virtual Device Manager

This will open a new window where you can create a new device. Click on the + sign

You will see a list of available devices. What we are looking for here is a device which can run API v29. The reason why we are choosing specifically this version is because versions 30 and above are a bit unstable and might not work as expected with this root access approach. Having said that, you can always try :), but in this guide, we will proceed with API v29. Other than that, it doesn't really matter what type of device (tablet, phone, TV) we are choosing. As long as it supports API v29, we are good to go. Click on the device and then click on the Create button.

This will open a new window where you can configure your new device Click on the API dropdown and choose System Image with API v29. Leave all other settings as is and click on the Finish button.

After that, a new system image will be installed to your machine. After installation, you will see a new device in the list of available devices.

Now that we have a new device, we can click on the run button and it will start the emulator.

With this device, we can do whatever we would do with our usual phone, like installing apps, playing games, etc. Our next step is to actually root it.
2. Rooting our device
First, we need to connect to the shell of this device through Android Debug Bridge (adb).
ADB is a versatile command-line tool provided by the Android SDK that enables communication between a computer and an Android device or emulator. It acts as a bridge for developers and power users to perform tasks like debugging apps, emulator control, and so on. ADB is included with the Android SDK, which is typically installed via Android Studio. So it should already be on our machine.
To check that, we need to run the following command in a new terminal:
adb devices
If everything up to this point was configured correctly, it is going to output the following:
List of devices attached
emulator-5554 device
That means our emulator is running and adb is installed. In the list, we can clearly see our current emulated device running.
The next step is to connect to the shell of the device. It allows us to interact with the device through commands. To do that, we need to run a command:
adb shell

As we can see, now it is possible to interact with the emulated device through the command line. For instance, we can type ls to list all files in the root directory. But as we can see, all of the files are currently with Permission denied status. That is because we still don't have root access.
We can try to enable the root access by running the following command:
su
Which gives us the following output:
Permission denied
To get necessary permissions, we will need to install a tool called Magisk on our emulated device.
Magisk is an open-source tool for rooting Android devices and emulators, offering a systemless approach to gain root access. Unlike traditional rooting methods that modify the system partition, Magisk modifies the boot image, allowing root access without altering core system files. This makes it ideal for maintaining compatibility with apps that detect root (e.g., banking apps) and enabling advanced customizations.
To install Magisk on our emulated device, we need to clone the rootAVD repo:
git clone https://gitlab.com/newbit/rootAVD.git
rootAVD is a script designed to root Android Virtual Devices (AVDs) running on the QEMU emulator within Android Studio, using Magisk to provide root access. It modifies the AVD's ramdisk image to integrate Magisk, enabling system-level access for advanced tasks like app testing, reverse engineering, and security research.
After you have cloned the repo, inside you will find a script called rootAVD.sh. We need to run this script. If you are on Windows, you need to run rootAVD.bat respectively.

To run the script, simply type:
./rootAVD.sh
You will see the following output:

As you can see, we have all of the commands which are supported by rootAVD. We need a specific one:
./rootAVD.sh system-images/android-29/google_apis_playstore/arm64-v8a/ramdisk.img
This command will install Magisk on our emulated device through which we will be able to gain root access to it. It is important to choose your version of the emulator. In my case, I am using API v29.
If you have your Android device running, it will reboot the device. If your device is not rebooting for some reason after this command execution, just reboot it yourself.
If you did everything correctly, upon reboot you will see a new app installed on your Android device:


Now we need to connect back to the shell of the device:
adb shell
And try to enable root access again:
su
If everything went well, you will see the following popup on your device screen:

whoami
And we should see that we are root.

Conclusion
In this guide, we have learned how to root your Android emulator phone. Thanks for reading! Check out our other guides below.