Ionic Release Too Slow Loading on phone?

I have an Ionic 2 application.I have already added the enableProdMod method inside main.ts.Plus,Neither of my providers run anything inside constructor to prevent any slow action.Morover,in app.component.ts constructor is the same as provider constructors and my app size nearly 15MB not too much.Eventhough all things are in favour of optimization of the application when I first install the apk on my android phone it takes 22 seconds to open the application everytime when I first open the application.Then it is getting faster on other pages.Also in my config xml is suitable for the recommended optimization.What is of it?Does Ionic load all content during the first loading on the phone? I strictly need to reduce that time to content my clients.Give me some clue for the solution please !!!

Thanks.

Don’t do that manually, it is done automatically.

How did you build your app? Did you use --prod to create an optimized built?

Upgrading to Ionic 3 would enable you to use lazy loading which should improve loading time a lot.

1 Like

İ have already tried --prod but Wè have several custom components and while building ngc creates problem about declaration duplicate please consider to move to a higher … etc. Because of this i could nothing build Thé application with --prod. Plus Wè use lazy Loading but unless login is passed nothing happened in Thé application so When i fırst open Thé application Thé root page is login and it is simple that nothing happens neither constructor nor iondidload , ngonInit.

You will have to get this fixed - --prod is required to get a snappy app.

What is your ionic info output?

I suggest you open new topics about the error messages you get on --prod builds. The community will help you fix those.

Custom components and lazy loading are not a great combination. You will get duplicated code for each component per lazily-loaded page that includes them.

Prod mode is not the solution.We will put the appliciation on store.I disabled all connections before the application is opened yet still it is opened on the real phone too slow as more than 20 seconds.

Why is --prod not the solution? It produces a much faster app than not using it as it builds the app in a totally different way. It produces less code and much smaller files.

If your app is still too slow with --prod, open a new topic and describe the problem - then we can debug your app and find out what is going wrong.

1 Like

–prod IS the solution - if your application cannot build with that tag you need to sort that before you even thinking about releasing.

2 Likes