V2 Android + Second app start doesn't work for release version

Okay… so this is a toughie…

My app has a canvas on it on the page html. On second start of initial install, app start doesn’t show canvas. I know because the body tag has a background and the canvas has a different background. The page does not have a module defined for it. This is only when built with --release


  • Ionic: 3.20
  • Cordova: 7.1.0
  • Angular: 5.2.9
  • Android: 6.1.2 (I think build target 25)
  • jdk: 1.8

Additional Info:
I am sort of doing bleeding edge stuff, but I am now out of the realm of being able to solve this on my own. I am using pixi.js, specifically from an additional interface library called angular2pixi. A2p doesn’t support --aot building.

Before I go on, let me reiterate everything works, even on multiple app restarts for everything other than --release.

The top level architecture is fairly simple:
a2p provides a service that has an instance of pixi. My app uses that service and has a page with a canvas awaiting Pixi’s rendering. When the app initializes, it starts up the pixi service, passing it the canvas reference and voila: html5ified angular.

I have offloaded the actual initialization of the rendering to a user clicked button to make sure it’s not something to do with life cycles but that didn’t work either. Even more interestingly, the button I made didn’t show when the app didn’t load. So likely, this means the ion-content itself isn’t showing!

Most interestingly, if I go into app info and delete storage (not cache) then it works on next app start! I am using localstorage but I attempted removing all mentions of it and no luck. ALSO On second install, or rather what would more technically be an update, the app works on every start after that.

This happens on android and I can’t seem to replicate it in iOS other than the first time I tried. Because it is a release build, it’s difficult to debug. I attempted using Ionic Pro Monitoring to no avail.

So far, my leanings are:

  • some type of caching causing a bug with the canvas itself
  • an error that is causing cordova or ionic to terminate
  • problem with my build process
  • a2p’s architecture (how could I go about debugging this given I have little knowledge of the underlying mechanics of cordova/ng2 -> native compilation?)
  • a cordova plugin (perhaps causing one of the above)

So as you can probably tell from my formatting, I’m somewhere between nerd heaven and hell. Such a fascinating problem… but plis halp

Right now, my page looks as such:


    Start Game

and the index.html:

  <!-- Ionic's root component and where the app will load -->
  <canvas id="worldCanvas" style="position: absolute;"></canvas>

The index is an attempt at fixing this, before hand the canvas was inside my page’s markup.

My plugins:

cordova-plugin-add-swift-support 1.7.0 "AddSwiftSupport"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-crosswalk-webview 2.4.0 "Crosswalk WebView Engine"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-ionic 1.1.9 "IonicCordova"
cordova-plugin-screen-orientation 3.0.1 "Screen Orientation"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
es6-promise-plugin 4.2.2 "Promise"

FYI I wrote a2p so have full access to change it as needed for it to be more compatible

It seems I have solved the problem. I was using cordova-plugin-ionic@3.x and switching it to 4.x (as well as updating it’s dependencies) along with changing UPDATE_METHOD to none seems to have resolved it. It’s possible it was updating in Background mode and updating my app to a broken version deployed to ionic Pro. Moral of the story, keep your environment up to date :+1:

1 Like

Well, that and turn off automatic updating if you have a broken build in Ionic Pro. Which is weird, as my version in Ionic Pro was likely lower than current build version