Stuck on Meteor Sample "todos" loading screen when launched on Android device
Question (s)
Example "todos" Meteor stuck on loading screen forever when I try to run it on android device. As shown in the screenshot below, the following error message is displayed:
Failed to load resource: net::ERR_ADDRESS_UNREACHABLE http://10.0.2.15:3000/sockjs/info?cb=...
The app also indicates that it has connection problems. Is it possible this could be due to a bug in the Cordova Meteor 1.0 release? Or am I missing some important setup / configuration 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 USB development and debugging support
- Chrome 38
Run these commands in Linux terminal
- meteor create --example todos
- cd todos
- ifconfig <------- gives inet addr: 10.0.2.15
- android device for meteorites -p 10.0.2.15:3000
Open Chrome DevTools
- Wait for the "todos" app to launch on my Android device (it does launch, but it doesn't move past the loading screen).
- Then open Google Chrome and enter "chrome: // inspect" in the search bar.
- Click the "Inspect" link under the "Todos" section that is listed on my Android device connected via USB.
source to share
Exam on imslavko answer ...
The mobile device downloads built-in templates and more via USB, but then tries to download data from the server. In your case, the mobile device is (or should be) connected to your local network via Wi-Fi provided by your router. I am also assuming your development computer is connected to this router.
The server is now running inside a virtual machine, making it difficult to access your server's mobile device. The IP address of the virtual machine (in your case 10.0.2.15) is not directly accessible from the rest of the local network, which will only see the IP of your host machine (probably 192.168.xx).
When you run the command meteor
run android-device βp 10.0.2.15:3000
you tell your counter to start a web server at that IP, but you also tell the mobile to look for a web server at that IP (which it cannot see as above).
So what are you doing? 2 things...
- You will need to redirect the transfer from the guest VM to your PC. Do it...
- Get the IP address of your host machine ... on windows run cmd then ipconfig .... save
- On the guest VM, get the IP of the ifconfig (in your case 10.0.2.15)
- On the guest virtual machine, go to the Virtual Box menu at the top, then Devices-> Network-> Network Settings ... in this window, click the "Port Forwarding" button.
- There the rule is added ... HostIP = your host IP from step 1, host port = 3000, guest IP = IP from step 2, guest port = 3000 .... click OK
- Then you need to tell the mobile device that it is looking for a server on a different IP address than the one the server is running on. Now, when you forward the web server IP to your host computer, you want the device to look at your PC of your PC.
so the new command will be ...
meteor run android-device βp 10.0.2.15:3000 --mobile-server 192.168.x.x:3000
source to share