Ionic app waits 20 seconds to start!

can anyone help me. I create an offline app with numbers of content in html form and pictures.
I used to create college university handbook application.
But when I launch apk and start the app. WHY IS IT TAKES SO LONG TO LOAD THE APP AROUND 20 SECONDS OR MORE? ANY SUGGESTION TO MAKE THE APP LOADS FAST IN THE FIRST OPEN?

@pinoyprogs How are you compiling the app? Are you using something like:

ionic cordova run android

or

ionic cordova run ios

If so, try using the --prod flag at the end of the command so it would look like:

ionic cordova run android --prod

If you’re getting an incredibly long white screen before the start of your application, this is due to the loading of javascript, html, and css that’s being compiled for your application.

1 Like

hi sir i used ionic cordova build android
is this not the right way?

yes sir exactly. when I start my app it stays in white screen for around 20 seconds before it loads…
Is there any alternative for this sir?
Yes I used to have hundreds of line of html for my contents

Why do you have so much html? Use loops for example, it makes your code more readable, less time when you have to change it. Overall, the more code you have, the more time you have to wait.

Clean your code, make it more efficient and you can use the command ionic cordova run android --device --prod

1 Like

my app is about school handbook sir so mostly content are in html forms. and yes i used some loops for specific task, but mostly content are so many.

If you’re looking to just run your app and have everything compiled on startup, then ionic cordova run android will serve it’s purpose.

If you’re looking for aot though, which I believe is what you’re asking for, as @henkverschoor1994 and I have stated, the --prod flag at the end of the run statement is going to help you out tremendously.

1 Like

thanks so much sir i will try it now :slight_smile: god bless

@pinoyprogs Warning: it’s going to take longer to compile than it did when you were just using the standard run command. Just a little heads up so that you’re aware of the timing difference.

1 Like

sir thank you so much it helps a lot. it only takes 5 seconds now to load the app. no more white screen. you really save my ass.

1 Like