I’m trying to build my app for android, so I used the command
ionic cordova build android --release
And launched the app successfully. However, it was taking around 20 seconds, so I uninstalled this version and created another build using this command :
ionic cordova build android --prod
This build of the app didn’t even launch, let alone reduce launch time. When I uninstalled this version and tried to run the first version of the app with the --release flag, which did launch the first time like I said, I had the same issue. Even this version of the app wasn’t launching and it was forever showing a blank white screen.
No changes were made to the code when I was building these versions of the app. So why has my release apk suddenly stopped working after replacing it with a prod version and then again replacing it back to the release version? Why did the release version stop working after doing this?
--release and --prod are not opposites. --release is the opposite of --debug which is the default. --prod is an additional flag that triggers a production build.
If you want to release your app, you should use both: --prod --release.
If something doesn’t work, you can debug it or see the error output during the output.
Would really like some help with this… does anyone know the latest versions I should be having and what command would update them? I tried updating ionic but that didn’t work
I found the issue : I was conditionally setting the rootPage of the app depending on the value in storage. Since there were no values in storage after relaunching the app, there was no rootPage that was defined, so that’s why I got a blank screen. Thank you for the help though
There’s nothing fundamentally wrong with this technique, but IMHO any property that is accessed by a template needs to be initialized at the point of its definition to something sane.
Nope, because what I’m suggesting is that where rootPage is declared, it should be initialized to some viable default, even if it’s an empty placeholder loading page.
Basically, assuming that HomePage is something you don’t mind accidentally flickering on startup occasionally. Probably not very likely in the real world.
Actually, this is exactly how I set it up at first, and I did see the flickering of the HomePage like you said. I didn’t find it very attractive, so I changed the code. But is there a chance that it won’t flicker?
Really depends on the speed of the device. Can you make a secondary splash page that you wouldn’t mind having flicker in and use that as the initializer?
I think that’s a good idea. I was thinking that I could maybe show a page with the logo of my app. Make that the default rootPage, and then my code will accordingly change the rootPage. Your thoughts?