更新时间:2023-01-26 08:08:29
Exapnding上imslavko的答案...
的移动设备下载intial模板和诸如此类的东西通过USB,但在此之后是尝试从服务器加载数据。在你的情况下,移动设备(或应该)连接到您的局域网通过Wifi,您的路由器提供。我也假设你的开发PC连接到该路由器。
现在服务器内的虚拟机这将使问题对于移动设备,看你的服务器上运行。该IP的虚拟机(在你的情况10.0.2.15)不直接从网络的其他部分,因为这只会看到您的主机的IP(可能是192.168.xx)进行访问。
在运行命令流星
运行Android设备-p 10.0.2.15:3000
您告诉您的仪器在那个IP启动Web服务器,但你也说的是移动设备,以寻找在该IP网络服务器(它不能看到如上文所述)。
所以,你该怎么办? 两件事情...
因此,新的命令会......
流星运行Android设备-p 10.0.2.15:3000 --mobile服务器192.168.XX:3000
The Meteor "todos" example is stuck on the loading screen forever when I try to run it on an android device. As can be seen in the screenshot below, the following error message is shown:
Failed to load resource: net::ERR_ADDRESS_UNREACHABLE http://10.0.2.15:3000/sockjs/info?cb=...
Also the app indicates it is having trouble connecting. Is it possible this could be due a bug in the Cordova Meteor 1.0 release? Or am I missing some important configuration/setup step?
Exapnding on imslavko's answer...
The mobile device downloads the intial templates and whatnot over USB, but after that is tries to load the data from the server. In your case the, the mobile device is (or should be) connected to your LAN via Wifi, provided by your router. I'm also assuming your dev PC is connected to that router.
Now the server is running inside a VM which would make it problematic for the mobile device to see your server. The IP in the VM (in your case 10.0.2.15) is not directly accessible from the rest of the LAN which would only see the IP of your host computer (likely 192.168.x.x).
When you run the command meteor
run android-device –p 10.0.2.15:3000
you are telling your meter to start a webserver at that IP, but you are also telling the mobile device to look for the webserver at that IP (which it can't see as stated above).
So what do you do? 2 things...
so the new command would be....
meteor run android-device –p 10.0.2.15:3000 --mobile-server 192.168.x.x:3000