I have referred to various posts but I don't think they seem to work, at all, whatsoever, when it comes to AVDs with Android 4.4 or 5.1.
I felt a need to post this.
So before posting this question, I have understood a basic need for rooting AVDs or even any device.
- Mount /system in rw mode.
- Push su binary; optionally busybox binary.
- do chmod to them, say, 6755. That should be it.
I followed posts and successfully rooted AVD with Android 2.2, however, I tried to repeat the same thing for Android 4.4 or 5.1 (both with SELinux disabled), but it seems that there is some kind of fallback mechanism.
For Android 4.4 and 5.1, /system will be mounted in rw mode, but, as soon as I try to push binaries, it gets reverted back to ro mode. Furthermore, it won't get back to rw mode as well, at least until I do a reboot. I keep getting a permission denied error.
Since these worked for Android 2.2 (with a modification in filesystem type and mountpoint), I intend to execute following commands (for Android 4.4 and 5.1):
adb root adb shell /system/bin/mount -o rw,remount -t ext4 /dev/block/vda /system adb push su /system/xbin/su adb shell chmod 06755 /system adb shell chmod 06755 /system/xbin/su
Anyone who has managed to root AVDs running these versions of Android are requested to help me in this.
I have experience with Android Studio & Windows.