如何获得Android模拟器的IP地址?模拟器、如何获得、地址、Android

2023-09-11 11:39:59 作者:微笑掩饰住伤口

我想获得当前正在运行的Android仿真器的IP地址,通过code。 怎样才可以实现?

I want to get the currently running Android Emulator's IP address through code. How can it be achieved?

推荐答案

只是为了澄清:从你的应用程序中,你可以简单地指仿真器为本地主机或127.0.0.1

Just to clarify: from within your app, you can simply refer to the emulator as 'localhost' or 127.0.0.1.

Web通信通过开发计算机传送,所以仿真器的外部IP是什么IP地址已经被分配到这台机器由您的供应商。该开发机总是可以从您的设备达到在10.0.2.2。

Web traffic is routed through your development machine, so the emulator's external IP is whatever IP has been assigned to that machine by your provider. The development machine can always be reached from your device at 10.0.2.2.

既然你问只关心的仿真器的IP 的,有什么事你想干什么?

Since you were asking only about the emulator's IP, what is it you're trying to do?