Anyone know how to edit /etc/hosts file inside an android studio emulator running in nougat? I will be editing it so I can use my virtual host in my local web server. I tried editing it through terminal using adb however, it is returning Read-only file system. Tried also using chmod but still it fails.
Update: I also tried pulling and pushing files using adb $ ./adb -s emulator-5554 push ~/Desktop/hosts /system/etc/hosts
adb: error: failed to copy '/Users/Christian/Desktop/hosts' to '/system/etc/hosts': couldn't create file: Read-only file system
I was able to edit the /etc/hosts file by launching the emulator with -writable-system and remounting the emulator using adb remount. After that the hosts file inside the emulator is editable. I tried pushing/replacing the file and succeeded.