Android - how to point the emulator / device to use MacOS system hosts file?
I need for the emulator to use the etc/hosts file on my mac. Is it possible to do that? Could开发者_如何学C I be pointed to links / blogs?
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.
精彩评论