The current online tutorials are as follows three articles:
1. Start the simulator with EMULATOR-AVD avdname-partition-size size
2. Gain root privileges through the ADB root and adb remount commands.
3. Transfer the Hosts file to the PC via the ADB pull/system/etc/hosts command, manually modify the hosts, and push the hosts file back through ADB push.
Still not working ...
The reason is that the carriage returns a newline character pounded by the ghost. Solution:
After performing the above 1, 22, do not execute 3rd, (ensure that the hosts file only one line 127.0.0.1 localhost) next execution:
A. adb shell enters shell mode
B.echo-e \\n >>/system/etc/hosts Write a line break
C.echo ***.***.***.*** www.whatever.com >>/system/etc/hosts write to your host,
If there are more than one host, repeat B and C
At this point, solve!
Fix invalid host file modification in Android emulator