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

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

问题描述

当我尝试在 Android 设备上运行 Meteor todos"示例时,它永远停留在加载屏幕上.从下面的屏幕截图中可以看出,显示了以下错误消息:

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?

  • 流星 1.0
  • 带有 VirtualBox 4.3.18 的 Ubuntu 14.04 虚拟机
  • 已启用开发者模式和 USB 调试的摩托罗拉 Droid Turbo (Android 4.4.4)
  • Chrome 38
  • 流星创建 --example todos
  • cd 待办事项
  • ifconfig <------- 给出 inet 地址:10.0.2.15
  • meteor 运行 android-device –p 10.0.2.15:3000
  • 等待todos"应用在我的 Android 设备上启动(它确实启动了,但不会越过加载屏幕).
  • 然后打开谷歌浏览器并在搜索栏中输入chrome://inspect".
  • 点击我通过 USB 连接的 Android 设备下列出的Todos"应用下的Inspect"链接.

推荐答案

Exapnding on imslavko's answer...

Exapnding on imslavko's answer...

移动设备通过 USB 下载初始模板等,然后尝试从服务器加载数据.在您的情况下,移动设备已(或应该)通过路由器提供的 Wifi 连接到您的 LAN.我还假设您的开发 PC 已连接到该路由器.

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 中运行,这会导致移动设备无法查看您的服务器.VM 中的 IP(在您的情况下为 10.0.2.15)无法从 LAN 的其余部分直接访问,而 LAN 的其余部分只能看到您主机的 IP(可能是 192.168.x.x).

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

那你怎么办?两件事...

So what do you do? 2 things...

  1. 您需要从访客 VM 转发到您的主机 PC.去做这个...
  1. You will need to port forward from the guest VM to your Host PC. To do this...
  1. 获取您的主机 IP... 在 Windows 中运行 cmd,然后 ipconfig.... 保存
  2. 在您的来宾 VM 上使用 ifconfig 获取 IP(在您的情况下为 10.0.2.15)
  3. 在您的来宾 VM 上,转到顶部的 Virtual Box 菜单,然后在该窗口中单击 Devices->Network->Network Settings... 中的Port Forwarding"按钮.
  4. 在那里添加一条规则... HostIP = 您在步骤 1 中的主机 IP,主机端口 = 3000,访客 IP = 来自步骤 2 的 IP,访客端口 = 3000.... 点击 OK
  5. 接下来,您需要告诉移动设备在与服务器实际运行的 IP 不同的 IP 上查找服务器.现在您正在将网络服务器 IP 转发到您的主机 PC,您希望设备查看您的主机 PC 的 IP

所以新命令将是....

so the new command would be....

meteor run android-device –p 10.0.2.15:3000 --mobile-server 192.168.x.x:3000

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

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