Stuck on Meteor example “todos” loading screen when running on an android device

前端 未结 2 1703
攒了一身酷
攒了一身酷 2021-01-07 06:15

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 f

相关标签:
2条回答
  • 2021-01-07 06:34

    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

    0 讨论(0)
  • 2021-01-07 06:35

    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.

    0 讨论(0)
提交回复
热议问题