Rooting Android Emulator

Requirements:

Instructions

Install the SuperSu.apk

  • Install the SuperSu app firstly.

  • After installing it, when you run it shows a screen as shown below indicating "There is no SU binary installed..". This error just confirms the device is not yet rooted.

Make emulator’ system partition writable

  • As it suggests, we need to give the emulator permission to write system files.

  • List the emulators installed on your PC emulator -list-avds

Emulator list
  • Navigate to the tools folder where Android SDK is installed and open command prompt there.

    • On Mac OS: ~/Library/Android/sdk/emulator

  • Type the following code to accomplish this: emulator -avd {emulator_name} -writable-system

Pushing su binary in system directory

  • Extract the Recovery flashable.zip (containing the su binaries of different architectures)

triangle-exclamation
  • Make sure you are running adb as root and also you need to remount. Just enter these codes

  • Now its time to push the su binary:

adb -e push adb -e push UPDATE-SuperSU-v2.82-20170528234214/x64/su /system/xbin/su

circle-info

Nevermind about my specific location of su binary, any location is okay as long there is no white space

circle-exclamation
circle-info

For emulators running android 5.1 and below use the su and not su.pie

Change permissions of the su binary

  • Next let's do a bit of modification of the permissions of su binary. We have to do this in emulator device through adb:

circle-exclamation
  • Setting the install directive on su binary and set a daemon

Setting SELinux to Permissive (i.e turning off SE Linux)

  • Finally turn off selinux through this code: setenforce 0

  • Open SuperSU app on the Mobile emulator and it may ask to update binaries, you can use Normal method.

circle-info

If you're experiencing bootloops, rather don't update the binaries, just use it as it is.

Now you have an emulator with root!

Last updated