Edit hosts file on android studio messed up my emulator I had to edit my emulator' hosts file in order to connect to a local development environment. I have followed this steps:

Run the emulator:

~/Library/Android/sdk/tools/emulator -writable-system -avd Nexus_5_API_19


In another terminal/cmd prompt:

adb reboot

adb root

adb -s emulator-5554 remount

adb -s emulator-5554 pull /system/etc/hosts hosts

add the IP to host file

adb -s emulator-5554 push hosts /system/etc/hosts

adb reboot


Now whenever I try to start my emulator from AVD Manager it is not responding. I always have to start it with:

 ~/Library/Android/sdk/tools/emulator -writable-system -avd Nexus_5_API_19


I mention that I work from High Sierra.

Mention: I have tried with adb to make my emulator rw but it did not allow me to push my hosts file.
There is an other way to manipulate the /etc/hosts  (You need a Linux machine )

Use the system.img which come from Google

go to your Android SDK home


cd $ANDROID_HOME


find the right system.img for your emulator


sudo mount -w system-images/android-25/google_apis/x86_64/system.img


edit the /etc/hosts


sudo vi /mnt/etc/hosts
sudo umount /mnt


Create an emulator (from Android Studio)


ASD Manager 
→ "Create Virtual Device"
→ Nexus 5X 
→ Next 
→ Tab x86 Images 
→ Nougart - 25 - x86_64 
→ Next 
→ "AVD Name" : "Nexus 5X API 25 with WLAN hosts" 
→ Finish


I have gone this way because emulator -writable-system -avd xx didn't work in my environment. Also mounting the system.img in my ~/.android/avd/xxxx directory didn't work anymore.