Android的 - 怎么点模拟器/设备使用的MacOS系统hosts文件? [英] Android - how to point the emulator / device to use MacOS system hosts file?
问题描述
我需要为模拟器用我的Mac上的etc / hosts文件。是否有可能这样做吗?我可以指着链接/博客?
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?
推荐答案
在Linux和OS X中,模拟器通过解析文件/etc/resolv.conf获得DNS服务器地址。在Windows上,仿真器通过调用GetNetworkParams()API获取地址。 请注意,这通常意味着模拟器忽略了你的hosts文件的内容(在/ etc /在Linux主机上,/私人的/ etc /在OS X主机,%WINDOWS%/ SYSTEM32 /在Windows主机上)。
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).
您可以,但是,告诉模拟器使用不同的DNS服务器(详情这个只是继续读取相同的页面我联系上方)。你可能只是想建立自己的小的DNS服务器,并通过做你的IP地址的解析。
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.
这篇关于Android的 - 怎么点模拟器/设备使用的MacOS系统hosts文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!