9

I am currently using 'Visual Studio Emulator for Android' to run android apps on my computer, i find that after using multiple types of emulators bluestacks, genymotion, andy etc. That VS is the most stable and easy-to-use out of them all.

The only problem that i have compared to the other emulators is running apps that require root permission, with this being an emulator i know that its not possible to go the route of rooting via fastboot/recovery, this is the only method i know of rooting as thats how i normally do it on my phone.

I have tried most of the 'rooting' APK's (kingo,towel,frama etc) and none of those have worked.

So would anybody happen to know how i can get root access on Visual Studio Android Emulator?

I am trying to run a touch-replication app (Frep & RepetiTouch) but all of them seem to require root access.

Any advice would be much appreciated. Thanks

user5384711
  • 99
  • 1
  • 1
  • 3
  • you should see this [link](http://android.stackexchange.com/questions/148841/attempt-to-root-avd-running-android-4-4-5-1-is-failing), It may help you! – evan Dec 19 '16 at 08:38

1 Answers1

3

Yes, you can. Here are some basics before the steps. Fundamentally all Visual Studio Emulator has root access; if you do adb shell you will get a root prompt. The only thing that is missing is the su binary and access for applications to connect to root shell through su. You can get the su binary from superuser apk from clockworkmod and the access to the root shell through the su daemon.

Installing su binary

  1. Download superuser apk from clockworkmod. Ideal way is to download the app from google play store and navigate to /data/app/ and copy com.koushikdutta.superuser to your pc through adb pull /data/app/com.koushikdutta.superuser <local_path_in_your_system>
  2. Change the .apk extension to .zip.
  3. Navigate to assets/x86/ and copy the su binary to /system/xbin in your emulator

    adb push <location_of_su> /system/xbin
    
  4. chmod with suid and rwx

        adb shell
        chmod 6777 /system/xbin/su
    
  5. symlink to /system/bin

        ln -s /system/xbin/su /system/bin/su
    
  6. Run the su daemon

    /system/xbin/su --daemon
    

Giving Access to Applications through su

  1. Install the superuser binary by either dragging and dropping into the emulator or using adb install <path_to_superuser_apk>
  2. Download rootchecker free\basic or even a terminal emulator for that matter. We just want to check if our device is rooted.
  3. Run the rootchecker app to check root and you should be able to get the prompt from superuser.
Antony Thomas
  • 3,576
  • 2
  • 34
  • 40
  • Somehow it does not work for me, in Android 5.1.1 emulator (the Visual Studio version). It does have its own su binary in /system/xbin, but when I replace it with the one from clockworkmod apk, any attempt to run it gives only an "error: only position independent executables (PIE) are supported." – gregko Dec 11 '15 at 21:33
  • Most of the executable are compiled PIE. You sure you are using the x86 version of su? – Antony Thomas Dec 11 '15 at 22:40
  • Also, try checking if the existing su has a --daemon option. If that were to be the case, you can use the existing su – Antony Thomas Dec 11 '15 at 22:41
  • Yes, I downloaded Superuser app via Google Play, which automatically selects the right binary, and I did copy su from x86 subdirectory. I also tried the existing su binary with --daemon option, did not complain at all. However any SuperUser app I tried still only says "su must be updated" and refuses to do its work. Rootchecker also say there is no root. – gregko Dec 12 '15 at 13:01
  • hmm.. guess this might be because of SE Linux in later Android versions. My original statement about PIE should be wrong. Nevertheless, the original 'su' is https://github.com/koush/Superuser. Try compiling the su binary with -fpie flag and you should be good. Try getting help from http://stackoverflow.com/questions/24818902/running-a-native-library-on-android-l-error-only-position-independent-executab. Let me know. – Antony Thomas Dec 12 '15 at 23:12