在Android设备上运行时,滞留的流星如“待办事项”载入画面 [英] Stuck on Meteor example “todos” loading screen when running on an android device

查看:793
本文介绍了在Android设备上运行时,滞留的流星如“待办事项”载入画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题(S)

流星待办事项的例子是卡在载入画面永远当我尝试在Android设备上运行。如可以在下面的截图中可以看出,显示以下错误消息:

 无法加载资源:净:: ERR_ADDRESS_UNREACHABLE HTTP://10.0.2.15:?3000 / sockjs /信息CB = ...
 

另外,应用程序表明它是有连接的麻烦。 是否有可能,这可能是由于在科尔多瓦流星1.0版本中的错误?还是我错过了一些重要的配置/设置步骤?

设置/配置

系统设置

  • 流星1.0
  • 的Ubuntu 14.04 VM VirtualBox的使用4.3.18
  • 在摩托罗拉Droid涡轮(安卓4.4.4)与开发模式和USB调试启用
  • 在Chrome浏览器38

运行在Linux终端这些命令

  • 在流星创建--example待办事项
  • CD待办事项
  • 在使用ifconfig< -------给INET地址:10.0.2.15
  • 在流星运行Android设备-p 10.0.2.15:3000

打开Chrome浏览器DevTools

  • 在等待,直到我的Andr​​oid设备上的待办事项应用程序启动(它不会推出,但它不会移动过去的载入画面)。
  • 然后打开谷歌浏览器,键入铬://检查,在搜索栏中
  • 点击下下,我通过USB连接的Andr​​oid设备中所列的托多斯应用程序中的检查链接。

解决方案

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网络服务器(它不能看到如上文所述)。

所以,你该怎么办? 两件事情...

  1. 您需要的端口转发从来宾虚拟机的主机PC。做这个事情...
    1. 让您的PC主机的IP ......在windows下运行cmd,之后使用ipconfig ....保存
    2. 在您的客户端虚拟机获得使用ifconfig IP(你的情况10.0.2.15)
    3. 在您的客户端虚拟机,进入虚拟盒顶部菜单,然后Devices->网络 - >网络设置......在窗口中单击端口转发按钮。
    4. 在有步骤1,主机端口= 3000添加规则... HOSTIP =您的主机的IP,访客IP = IP从第2步,来宾端口= 3000 ....点击OK
    5. 接下来您需要告诉您的移动设备来寻找服务器上不同的IP比一个服务器在实际运行。现在,你要转发的网络服务器IP到您的PC主机,你希望设备看你的PC主机的IP

因此​​,新的命令会......

流星运行Android设备-p 10.0.2.15:3000 --mobile服务器192.168.XX:3000

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?

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.

解决方案

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

这篇关于在Android设备上运行时,滞留的流星如“待办事项”载入画面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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