- #ANDROID ROOT EMULATOR HOW TO#
- #ANDROID ROOT EMULATOR INSTALL#
- #ANDROID ROOT EMULATOR ANDROID#
- #ANDROID ROOT EMULATOR ZIP#
- #ANDROID ROOT EMULATOR DOWNLOAD#
If you had installed the SuperSu app then you can just run the app and it might prompt you that there is a new version of the binary.
#ANDROID ROOT EMULATOR ANDROID#
Now you can restart the emulator via the command line, or via Android Studio.
In my situation, at this point the emulator seems to have hung/crashed. Logically this step sounds like it should have come earlier, but for some reason it came at the end and still worked. This indicates that the daemon (service) should run in the background. Notice the ampersand (&) at the end of the line with no space before. Now we set up the daemon, (also taken from the same StackExchange post) I just followed (from Android StackExchange).
#ANDROID ROOT EMULATOR INSTALL#
I’m not entirely sure what is going on in this step, but it looks like the su binary may have a -install directive to install some more things (maybe?). Step 3: Set the install directive on the su binary and set a daemon Also i noticed that originally the permissions on the su binary in the emulator had rwsr_x_x permissions if i remember correct. (I can’t remember exactly whether i used 06755, or just 755 as the permissions, but I seem to vaguely remember the former as what I used). Now we need to get into the emulator device through adb and change the permissions of the su binary.įor good measure, if you also put the binary in /system/bin/su you can also traverse into that directory and put the permissions of 06755 on the su binary there in. For good measure you can just do it, just incase. Not sure why, but some resources suggest that you need to push the binary to /system/bin/ for some Android versions. Remember that if you are using an Android emulator with a version lower than Android 5.1 you likely will have to use the plain su binary (not the su.pie)Īdb -e push C:\SuperSU-v2.79\x86\su /system/xbin/su Not sure why you need to remount, but for some reason it enables writing to the system partition, (after having used the -writable-system directive).Īdb -e push C:\SuperSU-v2.79\x86\su.pie /system/xbin/su Make sure you are running adb as root using. We now need to put the binary into the correct location as follows: NB: If you are using Android 5.1 and above (or if you are getting some errors about Position Independent Executables ), what you need is the su.pie binary, rather than the plain su binary.
#ANDROID ROOT EMULATOR ZIP#
In my case i’m running an emulator with Android x86 (on a Windows device), so i look under the x86 directory of the SuperSu ZIP archive. Locate the su binary for the correct architecture of the emulator that you are using. (As of writing this is Recovery Flashablev2.79).
#ANDROID ROOT EMULATOR DOWNLOAD#
You can download the Superuser binary from the supersu downloads section. Step 2: Get the SU binary and put it in the right directory Step 1: Start up the emulator with a writable system partition.Įmulator.exe -avd -writable-system Install the Supersu.apk file through sideloading as follows: The links are available at the SuperSu downloads section. Install the Supersu app either from Google Play or sideload it through adb. If you try to run it after all the steps below, it should open error free and (without the dialog telling you that the binary is not installed). If you install it now you, and try to run it, very likely it would indicate that the su binary was not installed. Ideally this step could come first before everything else, or last, after everything else. (Running these on Ubuntu, or some other Linux /Unix flavour should not be too different). I’ll assume we’re using a Windows machine as the host. I won’t claim I understand the whole process (particularly the daemon part), but i’ll document below what worked for me.
Install the SuperSu app, turn off SELinux policies and set up a daemon. Tl dr: The basic idea is to get the correct su (superuser) binary from the SuperSu project by Chainfire (Jorrit Jongma), put it in the right directory, change the permissions. Now this is NOT exactly what I wanted, I wanted more!! Rooting the Emulator: (The -e just means to direct the adb connection to the emulator) Notice the # telling you that you are root. Or getting into the emulator and using su, i.e.: Getting access to the filesystem as root is as easy as running: However, this does not mean that you will be able to run apps in the emulator directly as root. This means you can access privileged directories, change file/directory permissions, put apps and binaries in certain (many?) locations (not in the system partition, unless you make it writable), and run them via the command line interface. NB: Basically, through ADB (the Android debug bridge) you can get root access to the filesystem (only). I’ve tested this on the emulator bundled in Android Studio 2.3 with an emulator running Android 4.4 (Kitkat)and 7.1.1 (Nougat).
#ANDROID ROOT EMULATOR HOW TO#
Having struggled to easily find instructions on how to run apps as root on the Android Emulator, I’ve decided to document what worked for me.