Meteor 1.5.2 shows white screen after launch screen on Android only (sockjs canceled)


#1

I have a Meteor app that runs fine when using meteor run android-device but shows a white screen when running the resulting APK built by meteor build. When I look at the remote debugger I see that the application is trying several times to connect to the following URL with different cb param values, only to have the connection cancelled: https://myapp.co.com/sockjs/info?cb=asdfasdf.

Taking the same build, I run the iOS project through XCode on the simulator or iOS device and it connects and runs just fine. I also can go to the website and connect through a browser and the /sockjs calls connect.

Any idea why this is happening just with Android?

I have tried many things over the past few days so I’m running out of options. I tried setting the DDP_DEFAULT_CONNECTION_URL to the same hostname as my ROOT_URL. I also tried setting the MOBILE_ROOT_URL and MOBILE_DDP_URL as well with the same hostname. Still no joy.

Here is how I’m building my app:

meteor build ../dist --server=https://myapp.co.com:443 --mobile-settings ./settings.json

(note the = sign; I’ve tried with and without it)

Once the unsigned APK is created, I sign it with jarsigner and zipalign it.

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 release-unsigned.apk my-keystore
$ANDROID_HOME/build-tools/25.0.3/zipalign -f -v 4 release-unsigned.apk final.apk

Here’s the code the client initially hits in main.ts (it’s an Ionic app):

Meteor.startup(() => {
  // Switch to PROD mode for Angular if prod
  console.log("METEOR_SETTINGS = " + JSON.stringify(Meteor.settings));
  if (Meteor.settings.public.MODE.startsWith("prod")) {
    enableProdMode();
  }
  Meteor.call('reauthenticateUser', (err, user) => {
    if (err) {
      console.log("Error connecting to authentication services. Please try again later.", err);
      platformBrowserDynamic().bootstrapModule(AppModule);
    }
    else if (user) {
      console.log("user = " + user);
      Meteor.call('getUser', null, (err, user) => {
        console.log("gotUser");
        Session.set('user', user);
        platformBrowserDynamic().bootstrapModule(AppModule);
      });
    }
    else {
      console.log("else");
      platformBrowserDynamic().bootstrapModule(AppModule);
    }
  });
});

The above code results in me seeing the METEOR_SETTINGS but nothing from what’s inside the Meteor.call(). Again, on iOS and Web I do see the values as expected.

The server application is a Docker image built with launchpad and I use HAProxy to route 443 with a Verisign SSL Cert to port 3000 on the Meteor container.

Any help would be greatly appreciated!


#2

After adding the crosswalk plugin, I discovered that the SSL cert was the issue.