Rooting Android Emulator
Last updated
Last updated
Android Studio Installed
An Android Emulator running (for this tutorial version 5.1 -API 21-)
SuperSU Mobile app (chainfire)
(called SuperSU APK)
Recovery flashable.zip
(called SuperSU ZIP)
provided by XDA user
Install the SuperSu app firstly.
You can do it from the device from , or
Sideload through adb i.e adb -e install supersu.apk
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.
As it suggests, we need to give the emulator permission to write system files.
List the emulators installed on your PC emulator -list-avds
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
Extract the Recovery flashable.zip (containing the su binaries of different architectures)
Important! Only use the su binary that matches your AVD architecture e.g x86, arm etc.., and note the path where you extracted these binaries.
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
To figure out bin or xbin do in console before:
adb shell
ls /system/xbin/su
Next let's do a bit of modification of the permissions of su binary. We have to do this in emulator device through adb:
Take note of su binary path (mine is /system/xbin
)
Setting the install
directive on su binary and set a daemon
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.