Android - how to point the emulator / device to use MacOS system hosts file?

荒凉一梦 提交于 2019-12-23 05:19:26

问题


I need for the emulator to use the etc/hosts file on my mac. Is it possible to do that? Could I be pointed to links / blogs?


回答1:


According to developer documentation in the section titled "Configuring the Emulator's DNS Settings":

On Linux and OS X, the emulator obtains the DNS server addresses by parsing the file /etc/resolv.conf. On Windows, the emulator obtains the addresses by calling the GetNetworkParams() API. Note that this usually means that the emulator ignores the content of your "hosts" file (/etc/hosts on Linux, /private/etc/hosts on OS X, %WINDOWS%/system32/HOSTS on Windows).

You can, however, tell the emulator to use a different DNS server (for details on this just keep reading on that same page I linked to above). You might just wanna setup your own little dns server and do all your ip address resolution through that.



来源:https://stackoverflow.com/questions/7639034/android-how-to-point-the-emulator-device-to-use-macos-system-hosts-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!