Help with Ionic app Slow startup

I have just completed my project which is a book with titles and description and the ability to search for each item.
but it take about 15 sec to load. which is too slow for me. it also shows a white screen after the splash screen.
please help. below is my package.json file. thanks

"dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/core": "3.12.1",
        "@ionic-native/splash-screen": "3.12.1",
        "@ionic-native/status-bar": "3.12.1",
        "@ionic/storage": "2.0.1",
        "cordova-android": "^6.2.3",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.2",
        "cordova-plugin-whitelist": "^1.3.1",
        "ionic-angular": "3.6.0",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.12"
    },
    "devDependencies": {
        "@ionic/app-scripts": "2.1.3",
        "@ionic/cli-plugin-ionic-angular": "1.4.1",
        "ionic": "3.7.0",
        "typescript": "2.3.4"
    },
1 Like

How many pages?
How big are these pages?
What is your ionic info output?
Have you implemented Lazy loading already?
How did you build your app?

1 Like

just three pages
one is the welcome page
The other is a page where the content is shown
I used ngfor to repeat items which are titles from data stored in the controller and
the last page is used to display the details as stored in the controller.
I am not sure i know much about lazy loading, however i assume this app is not that big to have this kind of experience. thanks.

How big are the data files that contain the content to be displayed?

Also:

It is just about 20 pages in MS word

Did you do a production build yet? (Ionic Cordova build PLATFORM --release)

Adding the production flag cut startup time for my app from 6 seconds down to 2 seconds, so maybe it would do the same for you.

1 Like

This is not a production build, but a release build. For a production build you have to add --prod - which actually will make the app start a lot faster.

That’s why I asked @rafadeaderinwale several times how he builds the app - but he always ignores that question.

1 Like

Sorry, yep, I should have suggested adding the --prod flag! It should cut his startup time down a significant amount. Thanks for the correction @Sujan12 !

Sorry I did not know i left that question out. However I have built with all the options i know. i have even built through the android studio. I generated the key and even signed the apk. that is the reason i am so confuse.

Please post the exact command you used to build the app.

At this point I will assume it is a problem with one of the dependencies i am using. i dont just know what it is. thanks so much for your help

Without your ionic info output we don’t know anything about your computer and OS, so it’s harder to help you.

For example, if If you’re on a Mac and building for iOS you need to build through the terminal command ‘ionic Cordova build iOS --prod’

Your dependencies look fine, you aren’t using any special plugins that might cause the long boot time. This is almost certainly a build issue

I built it using
ionic cordova build android --prod --release
and also tried it without the release

my installed android platform is 6.2.3

Post your ionic info please.
Using any additional Cordova plugins?
How long does a new app created with ionic start blank blank take on your environment to start?

cli packages: (C:\Users\HP\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.7.0
ionic (Ionic CLI) : 3.7.0

System:

Android SDK Tools : 26.0.2
Node              : v6.11.0
OS                : Windows 10
npm               : 3.10.10

no additional cordova plugins
i had to do that test yday and a blank app took about 12sec to load

Run that command in your Ionic project folder please.

That is pretty slow, and your fully loaded app is not much slower.
What device and OS version are you testing with?

Hi after trying all I could i finally decided to remove all the apps and reinstall. nodejs went smooth but ionic and cordova gave me errors. this is an extract from the log. do you have any ideas.

8163 silly extract dependency-ls@1.1.1
8164 verbose unlock done using C:\Users\HP\AppData\Roaming\npm-cache\_locks\staging-44c5448c6858e3d9.lock for C:\Users\HP\AppData\Roaming\npm\node_modules\.staging
8165 warn optional SKIPPING OPTIONAL DEPENDENCY: rx-lite@3.1.2 (node_modules\cordova\node_modules\rx-lite):
8166 warn optional SKIPPING OPTIONAL DEPENDENCY: sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI= integrity checksum failed when using sha1: wanted sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI= but got sha1-FGHEQ8pu6JiN6eEf7bfp05gBxLE=. (48620 bytes)
8167 warn optional SKIPPING OPTIONAL DEPENDENCY: jju@1.3.0 (node_modules\cordova\node_modules\jju):
8168 warn enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Users\HP\AppData\Roaming\npm\node_modules\.staging\jju-9f29213a\lib\document.js'
8169 verbose enoent SKIPPING OPTIONAL DEPENDENCY: This is related to npm not being able to find a file.
8169 verbose enoent SKIPPING OPTIONAL DEPENDENCY:
8170 warn optional SKIPPING OPTIONAL DEPENDENCY: buffer@4.9.1 (node_modules\cordova\node_modules\buffer):
8171 warn enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Users\HP\AppData\Roaming\npm\node_modules\.staging\buffer-1d0d205c\index.js'
8172 verbose enoent SKIPPING OPTIONAL DEPENDENCY: This is related to npm not being able to find a file.
8172 verbose enoent SKIPPING OPTIONAL DEPENDENCY:
8173 warn optional SKIPPING OPTIONAL DEPENDENCY: boom@2.10.1 (node_modules\cordova\node_modules\boom):
8174 warn enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Users\HP\AppData\Roaming\npm\node_modules\.staging\boom-d2fbfe10\README.md'
8175 verbose enoent SKIPPING OPTIONAL DEPENDENCY: This is related to npm not being able to find a file.
8175 verbose enoent SKIPPING OPTIONAL DEPENDENCY:
8176 warn optional SKIPPING OPTIONAL DEPENDENCY: json-schema@0.2.3 (node_modules\cordova\node_modules\json-schema):
8177 warn enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Users\HP\AppData\Roaming\npm\node_modules\.staging\json-schema-cccdd68f\lib\validate.js'
8178 verbose enoent SKIPPING OPTIONAL DEPENDENCY: This is related to npm not being able to find a file.
8178 verbose enoent SKIPPING OPTIONAL DEPENDENCY:
8179 warn optional SKIPPING OPTIONAL DEPENDENCY: jschardet@1.5.1 (node_modules\ionic\node_modules\jschardet):
8180 warn enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Users\HP\AppData\Roaming\npm\node_modules\.staging\jschardet-d5c2db4f\dist\jschardet.min.js'
8181 verbose enoent SKIPPING OPTIONAL DEPENDENCY: This is related to npm not being able to find a file.
8181 verbose enoent SKIPPING OPTIONAL DEPENDENCY:
8182 verbose type OperationalError
8183 verbose stack Error: sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= integrity checksum failed when using sha1: wanted sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= but got sha1-8KUsOameHhDxpbCm449UbpuvqBE=. (4996 bytes)
8183 verbose stack     at Transform.on (C:\Program Files\nodejs\node_modules\npm\node_modules\ssri\index.js:275:19)
8183 verbose stack     at emitNone (events.js:110:20)
8183 verbose stack     at Transform.emit (events.js:207:7)
8183 verbose stack     at endReadableNT (_stream_readable.js:1045:12)
8183 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
8183 verbose stack     at process._tickCallback (internal/process/next_tick.js:180:9)
8184 verbose cwd C:\Users\HP
8185 verbose Windows_NT 10.0.14393
8186 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ionic" "cordova"
8187 verbose node v8.3.0
8188 verbose npm  v5.3.0
8189 error code EINTEGRITY
8190 error sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= integrity checksum failed when using sha1: wanted sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= but got sha1-8KUsOameHhDxpbCm449UbpuvqBE=. (4996 bytes)
8191 verbose exit [ 1, true ]

These are corrupt downloads. Try to isolate whether it is a problem with your box or your network. Either bring this computer to a different network environment or bring a different computer into this network. Whichever the problem follows is the culprit. It could be impending disk failure, failing RAM, overheating/bad PSU, or something is interfering with your network. Either way, things are seriously wrong here. Especially combined with the long load times (if these are happening on an emulator on the build box), I lean towards suspecting some sort of hardware issue here.

I got it to work the hard way. Had to delete the NodeJS and remove all packages manually. them with a clean slate, I re Installed all the apps and used the ionic cordova run android --prod. it worked so well. now my app loads within three seconds. Thanks to you all

1 Like