Hi community.
I know this is a problem that has been revisited again and again and many posts discuss it.
I’ve found and try I think, a lot of suggestions, and still don’t get unstuck.
I was working on my big, complex app and trying to use the traditional
meteor run android-device
to try out a new QR camera reader. But, even when the app went through to my phone and got installed and running, I continuously get the infamous “waiting” in the object returned by Meteor.status().
I’ve seen many posts here and in stack overflow about it. For example this one, or this one or this one. But none of them had solved my problem.
One guy suggested that I’d started to remove all my Cordova plugins one by one to find a guilty one.
So, instead, I created a project from one of meteor templates and tried if the problem reproduces there as well. It does.
meteor create --react simple-todos-react
Things I’ve tried/checked:
- Verified that my wifi allows devices to talk to each other (from my cellphone’s browser I can access the app in my laptop using it’s local IP)
- Explicitly tell meteor to use my local IP as mobile server
meteor run android-device --mobile-server=http://192.168.0.1:3000
meteor run android-device --mobile-server=192.168.0.1:3000
meteor run android-device --mobile-server=192.168.0.1
- All kind of thingies with BrowserPolicy in the startup function at server/main.js
import { BrowserPolicy } from "meteor/browser-policy"
Meteor.startup(() => {
BrowserPolicy.content.allowOriginForAll("http://meteor.local");
BrowserPolicy.content.allowOriginForAll("localhost");
BrowserPolicy.content.allowOriginForAll("127.0.0.1");
BrowserPolicy.content.allowOriginForAll("192.168.0.14");
BrowserPolicy.content.allowOriginForAll("192.168.0.14:3000");
BrowserPolicy.content.allowOriginForAll("http://192.168.0.14:3000");
BrowserPolicy.content.allowOriginForAll("http://192.168.0.14");
BrowserPolicy.content.allowConnectOrigin("http://meteor.local")
BrowserPolicy.content.allowConnectOrigin("localhost")
BrowserPolicy.content.allowConnectOrigin("127.0.0.1")
BrowserPolicy.content.allowConnectOrigin("192.168.0.14")
BrowserPolicy.content.allowConnectOrigin("192.168.0.14:3000")
BrowserPolicy.content.allowConnectOrigin("http://192.168.0.14:3000")
BrowserPolicy.content.allowConnectOrigin("http://192.168.0.14")
});
- adding the mobile-config.js at the root of the project with the line
App.accessRule("*");
I do see some warnings/errors when running the android-device cmd line.
I20201116-15:39:16.490(-3)? 11-16 15:38:14.238 25652 25748 W chromium: [WARNING:dns_config_service_posix.cc(342)] Failed to read DnsConfig.
For one and some others that I’ve seen to say are irrelevant, but just in case, several lines of this tenor:
I20201116-15:39:16.490(-3)? 11-16 15:38:14.586 25652 25652 W MeteorWebApp: Loading asset bundle from directory file:///android_asset/www/application
I20201116-15:39:16.491(-3)? 11-16 15:38:15.198 25652 25759 W MeteorWebApp: Asset / found in bundle e90fc8e64583819f357dd75c046fc9cc130515c0:file:///android_asset/www/application
I’ve modified the ‘Hello.jsx’ component of the template with a single line showing the Meteor.status() returned object that gets updated with each “Click Me” click:
import React, { useState } from 'react';
export const Hello = () => {
const [counter, setCounter] = useState(0);
const increment = () => {
setCounter(counter + 1);
};
return (
<div>
<button onClick={increment}>Click Me</button>
<p>You ve pressed the button {counter} times.</p>
<p>Status: {JSON.stringify(Meteor.status(), 0, 2)}</p>
</div>
);
};
The output is always the same: the status get stuck on “waiting”.
I find it odd (and unlikely) that a template would work bad out of the box, so I think my last guilty suspect is my own Android SDK setup?
Any help to think, guidance on how to attack, etc, will be most welcome. The truth is that I don’t understand the why of this error, and so it all feels wasting time and blindly trying stuff out.
Thanks a lot.