如何获得Android模拟器的IP地址? [英] How to get the Android Emulator's IP address?

查看:471
本文介绍了如何获得Android模拟器的IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得当前正在运行的<一个href="http://en.wikipedia.org/wiki/Android%5F%28operating%5Fsystem%29#Software%5Fdevelopment%5Fkit">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?

这篇关于如何获得Android模拟器的IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆