Android的本地主机? [英] Android Localhost?
问题描述
我知道这已被要求之前回答,但我用 10.0.2.2
仿真器。我听见我必须用别的东西我真正的设备。谁能告诉我是什么吗?我能有他们俩私奔 1
的URL。而不是有一个仿真器和实际的设备。
Android的本地主机?
块引用>
本地主机
Android设备的是本地主机
127.0.0.1。
我用10.0.2.2仿真器
块引用>这是指
本地主机
运行仿真器的计算机。
和我听说我必须用别的东西我真正的设备
块引用>您需要使用的计算机的IP地址,无论网络的计算机和设备共享上。您不能访问
本地主机
一台机器上从另一台计算机,顾名思义。当然,你还需要弄清楚不管它是该计算机上运行的听比自己的更
本地主机
。
有没有一种方法,我可以使用,而不是使用10.0.2.2为我的模拟器,不得不用我的设备另外一个单一的IP
块引用>不是真的。此外,无论是你所想的值都为您的应用程序的发布版本是正确的,在所有的可能性。在那里,你将需要使用的域名(或者,在紧要关头,IP地址)的一些公开可见的服务器的每个人的的设备可以达到。
I know this has been asked and answered before, but I use
10.0.2.2
for the emulator. And I heard I must use something else for my real device. Can someone tell me what that is? And can I have them both run off of1
URL. Instead of having one for the emulator and actual device.解决方案Android Localhost?
localhost
of an Android device islocalhost
, 127.0.0.1.I use 10.0.2.2 for the emulator
That refers to
localhost
of the computer running the emulator.And I heard I must use something else for my real device
You need to use the IP address of the computer, on whatever network that the computer and the device share. You cannot access
localhost
on one machine from another machine, by definition.Of course, you also need to figure whatever it is that is running on that computer to listen to more than its own
localhost
.Is there a way I can use a single IP Instead of using 10.0.2.2 for my emulator and having to use another one for my device
Not really. Moreover, neither of the values that you are thinking of are the right ones for a release build of your app, in all likelihood. There, you will need to use the domain name (or, in a pinch, IP address) of some publicly-visible server that everyone's devices can reach.
这篇关于Android的本地主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!