Edit hosts file on android studio messed up my emulator
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.