I have upgraded an Ionic 3 app to Ionic 5 and almost ready to go live with it but I have noticed that certain things are very slow when running on Android such as the initial loading of icons.
I have connected the Android device (Samsung Galaxy S8) to Chrome dev tools and I can see that certain JS and SVG files are taking 5 seconds to load the first time. These files should be local to the device so why is this taking so long?
These problems do not appear to happen on iOS (iPhone 11 Pro) although it is a newer and faster device so maybe it is just not noticable. Screenshots below showing the files that are taking a long time.
It’s hard to tell what the issue is from just that.
Do you have a sample of the project up on github?
Are you lazy-loading routes?
Whats the setup of the app look like?
Thanks for getting back to me, I do not have a sample of the project on github unfortunately (I could possibly create one but it would take me a bit of time as I would have to strip out a lot of my code to stop it getting in the hands of the wrong people).
I have “PreloadAllModules” set in my app-routing.module file as per the following screenshot.
The setup of the App is fairly standard, it is Angular, I followed the migration guide by creating a new Ionic 4 Angular project then migrated over each page and service following the documentation updating any parts as necessary. I then upgraded to Ionic 5 which as you know if fairly straightforward once you are on Ionic 4.
Strangely enough, I have restarted the phone (Samsung Galaxy S8) and the problem seems to have resolved itself, very odd, even though I was completely closing down the App in between testing (because the issue only happened during the first loading of each icon so I needed to completely close the App to test the problem each time). Just as a note, the phone is a completely fresh install that is only used for testing this App so it doesn’t have any other applications etc running in the background or anything like that.
Without knowing the ins and outs of how Ionic/Cordova Apps run I am not sure if somehow there was a problem with the webview that the device was using that was only resolved by restarting the device? Hopefully, this was a one-off and not something that will happen again especially to users when it is live on the App Stores or not something that was caused by possibly some type of cache on the device getting full? Have you heard of anything like this before or is there anything I could check within my app to ensure I haven’t done anything that could result in an issue like this returning?
I did see a couple of other people reporting a similar issue when I was searching for a solution which makes me wonder if this isn’t just a one-off that has affected me and whether there is something in the way the App has been setup or the way Android devices work that could have caused this?
Honestly android makes this a can of worms. It could be a number of things. Given the age of the device, potential resources, etc etc, it wouldn’t surprise me that the device was just at the limit for it’s resources and needed a hard refresh.
Without a sample app, I can’t do much. I really need one to understand the issue.