停留在流星示例“todos”加载屏幕上运行在Android设备上 [英] Stuck on Meteor example “todos” loading screen when running on an android device

查看:193
本文介绍了停留在流星示例“todos”加载屏幕上运行在Android设备上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Android设备上运行时,Meteortodos示例永远停留在加载屏幕上。从下面的屏幕截图中可以看到,显示以下错误消息:

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=...

表示连接有问题。
这可能是由于Cordova Meteor 1.0版本中的一个错误?或者我缺少一些重要的配置/设置步骤?

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?


  • Meteor 1.0

  • Ubuntu 14.04 VM with VirtualBox 4.3.18

  • 启用开发人员模式和USB调试功能的Motorola Droid Turbo(Android 4.4.4)

  • Chrome 38

  • Meteor 1.0
  • Ubuntu 14.04 VM with VirtualBox 4.3.18
  • Motorola Droid Turbo (Android 4.4.4) with Developer Mode and USB debugging enabled
  • Chrome 38

  • meteor create --example todos

  • cd todos

  • ifconfig< :10.0.2.15

  • meteor运行android-device -p 10.0.2.15:3000

  • meteor create --example todos
  • cd todos
  • ifconfig <------- gives inet addr:10.0.2.15
  • meteor run android-device –p 10.0.2.15:3000

  • 等待todos应用在我的Android设备上启动(它会启动,

  • 然后打开Goog​​le Chrome并在搜索栏中输入chrome:// inspect。


推荐答案

解决imslavko的问题。

Exapnding on imslavko's answer...

移动设备通过USB下载初始模板和其他内容,但之后尝试从服务器加载数据。在你的情况下,移动设备是(或应该)通过Wifi连接到您的LAN,由路由器提供。我也假设你的电脑连接到那个路由器。

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.

现在服务器在VM中运行,这会使移动设备出现问题,看到您的服务器。虚拟机中的IP(在您的情况下是10.0.2.15)不能从LAN的其余部分直接访问,只能看到您的主机计算机的IP(可能是192.168.xx)。

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).

运行命令meteor

When you run the command meteor

运行android-device -p 10.0.2.15:3000

您正在告诉您的仪表在该IP启动一个网络服务器,但您也告诉移动设备在该IP寻找网络服务器(它不能见上文)。

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).

那么你做什么呢?
2件...

So what do you do? 2 things...


  1. 您需要从访客VM端口转移到您的主机。要做到这一点...
  1. You will need to port forward from the guest VM to your Host PC. To do this...

  1. 获取您的主机PC IP ...在Windows运行cmd,然后ipconfig ....保存

  2. 在客户虚拟机上,使用ifconfig(在您的情况下为10.0.2.15)获取IP。

  3. 在客户虚拟机上,转到顶部的虚拟框菜单, >网络设置...在该窗口中单击端口转发按钮。

  4. 在其中添加规则... HostIP =您的主机IP从步骤1,主机端口= 3000,访客IP = IP从步骤2,访客端口= OK

  5. 接下来,您需要告诉您的移动设备在服务器实际运行的IP上使用不同的IP来查找服务器。现在您正在将网络服务器IP转发到您的主机PC,您希望设备查看您的主机PC的IP。

  1. Get your host PCs IP... in windows run cmd, then ipconfig.... save that
  2. On your guest VM get the IP with ifconfig (in your case 10.0.2.15)
  3. On your guest VM, go to the Virtual Box menu at the top then Devices->Network->Network Settings... in that window click the "Port Forwarding" button.
  4. In there add a rule... HostIP = your hosts IP from step 1, Host Port = 3000, Guest IP = IP from step 2, Guest Port = 3000.... hit OK
  5. Next you need to tell your mobile device to look for the server on a different IP than the one the server is actually running on. Now that you are forwarding the webserver IP to your host PC you want the device to look at your host PC's IP


所以新命令将是....

so the new command would be....

meteor运行android-device -p 10.0.2.15: 3000 --mobile-server 192.168.xx:3000

这篇关于停留在流星示例“todos”加载屏幕上运行在Android设备上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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