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
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