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

本文是小编为大家收集整理的关于在安卓设备上运行时,卡在Meteor例子 "todos "的加载屏幕上的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

问题

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

Failed to load resource: net::ERR_ADDRESS_UNREACHABLE http://10.0.2.15:3000/sockjs/info?cb=...

此外,应用程序表示它在连接方面遇到困难. 这可能是Cordova Meteor 1.0释放中的错误吗?还是我错过了一些重要的配置/设置步骤?  Meteor Todos示例卡在加载屏幕上

设置/配置

系统设置

  • 流星1.0
  • ubuntu 14.04 vm with virtualbox 4.3.18
  • Motorola Droid Turbo(Android 4.4.4)具有开发人员模式和USB调试启用
  • Chrome 38

在Linux终端中运行这些命令

  • 流星创建 - example todos
  • CD Todos
  • ifconfig <-------给出Inet addr:10.0.2.15
  • 流星运行Android设备–P 10.0.2.15:3000

打开Chrome Devtools

  • 等到" Todos"应用程序在我的Android设备上启动(它确实启动,但不会越过加载屏幕).
  • 然后打开Goog​​le Chrome,然后在搜索栏中键入" Chrome://Inspect".
  • 单击我通过USB连接的Android设备下列出的" Todos"应用程序下的"检查"链接.

 Chrome Inspect USB设备

推荐答案

imslavko的答案上的exapnding ...

移动设备下载了Intial模板以及USB上的内容,但是此后尝试从服务器加载数据.在您的情况下,移动设备是(或应该)通过路由器提供的WiFi连接到您的LAN.我还假设您的开发PC已连接到该路由器.

现在,服务器在VM内部运行,这将使移动设备查看您的服务器有问题. VM中的IP(在您的情况下为10.0.2.15)无法直接从LAN的其余部分访问,该LAN只能看到主机计算机的IP(可能192.168.x.x).

运行命令流星

run android-device –p 10.0.2.15:3000

您正在告诉仪表在该IP上启动Web服务器,但您还告诉移动设备在该IP上查找WebServer(它看不到上面说明的).

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

  1. 您将需要从访客VM转移到主机PC.去做这个...
    1. 在Windows运行CMD中获取主机PC IP ...然后ipconfig ....保存该
    2. 在您的来宾VM上使用IFConfig获取IP(在您的情况下10.0.2.15)
    3. 在您的来宾VM上,转到顶部的虚拟框菜单,然后设备 - > Network->网络设置...在该窗口中,单击"端口转发"按钮.
    4. 在其中添加一个规则... hostip =您的主机IP从步骤1,主机端口= 3000,访客ip = ip = ip from步骤2,访客端口= 3000 .... hit ok ok
    5. 接下来,您需要告诉您的移动设备在IP上查找服务器与服务器实际运行的服务器不同.现在,您将WebServer IP转发到主机PC,您希望设备查看主机PC的IP

所以新命令将是....

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

其他推荐答案

您的应用无法连接到服务器(设备和计算机可能在不同的网络上,或者您的家庭网络具有隔离式隔离).

应用程序中的代码明确保存加载屏幕,直到加载初始数据为止.

本文地址:https://www.itbaoku.cn/post/102520.html

问题描述

Issue(s)

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? Meteor todos example stuck on loading screen

Setup / Configuration

System Setup

  • 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

Run these commands in the Linux terminal

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

Open Chrome DevTools

  • Wait until the “todos” app launches on my android device (it does launch but it doesn’t move past the loading screen).
  • Then open up Google Chrome and type “chrome://inspect” in the search bar.
  • Click on the “Inspect” link under the “Todos” app listed under my Android device connected via USB.

Chrome Inspect USB Devices

推荐答案

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

  1. You will need to port forward from the guest VM to your Host PC. To do this...
    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 run android-device –p 10.0.2.15:3000 --mobile-server 192.168.x.x:3000

其他推荐答案

Your app can not connect to the server (it might that the device and your computer are on different networks, or your home network has client isolation turned on).

The code in the app explicitly holds the load screen until it loads the initial data.