How to Modify Android Emulator Hosts file
Modifying hosts file is very important and useful trick for web development. Android hosts file is located in /system/etc/ directory.
Below is the steps to modify Android emulator hosts file.
- emulator -avd you_avd_name -partition-size 128. Start emulator from command line. I have tried to start emulator via Android SDK Manager, but kept geting Out of Memory when pushing back the file.
- adb remount. Remount the file system, otherwise when pushing back the file, you will get error: read-only file system.
- adb pull /system/etc/hosts /your/local/path. Pull the hosts file from emulator.
- adb push /your/local/path/hosts /system/etc. Push back the hosts file with your changes.
For locked android phone, we need unlock it to gain the root privileges first.