Startup long in android for ionic 3


#1

Hello,

Yesterday I migrated to ionic 3.
To do this I first migrated to next version of the cli. Then I removed my node_module and update my package.json before running the npm install ( I also removed the package.json.lock)

But now the startup of my app is really long…
First my build prod faced lot of issues ( I was obliged to increase the node build to 8192)

Anyway now I am using latest of everything:


cli packages: (c:\Users\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:

    cordova (Cordova CLI) : 7.0.0

local packages:

    @ionic/app-scripts : 3.1.0
    Cordova Platforms  : android 6.2.2
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.1.3
    Node              : v6.11.3
    npm               : 5.3.0
    OS                : Windows 7

Environment Variables:

    ANDROID_HOME : D:\Userfiles\Documents\perso\android\sdk

Misc:

    backend : pro

Here is my package.json:

   "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "5.0.0",
        "@angular/compiler": "5.0.0",
        "@angular/compiler-cli": "5.0.0",
        "@angular/core": "5.0.0",
        "@angular/forms": "5.0.0",
        "@angular/http": "5.0.0",
        "@angular/platform-browser": "5.0.0",
        "@angular/platform-browser-dynamic": "5.0.0",
        "@angular/platform-server": "5.0.0",
        "@ionic-native/app-availability": "4.3.3",
        "@ionic-native/barcode-scanner": "4.3.3",
        "@ionic-native/camera": "4.3.3",
        "@ionic-native/clipboard": "4.3.3",
        "@ionic-native/contacts": "4.3.3",
        "@ionic-native/core": "4.3.3",
        "@ionic-native/device": "4.3.3",
        "@ionic-native/facebook": "4.3.3",
        "@ionic-native/file": "4.3.3",
        "@ionic-native/geolocation": "4.3.3",
        "@ionic-native/globalization": "4.3.3",
        "@ionic-native/google-plus": "4.3.3",
        "@ionic-native/in-app-browser": "4.3.3",
        "@ionic-native/launch-navigator": "4.3.3",
        "@ionic-native/linkedin": "4.3.3",
        "@ionic-native/network": "4.3.3",
        "@ionic-native/push": "4.3.3",
        "@ionic-native/social-sharing": "4.3.3",
        "@ionic-native/splash-screen": "4.3.3",
        "@ionic-native/status-bar": "4.3.3",
        "@ionic/storage": "2.1.3",
        "@types/cropperjs": "0.0.22",
        "@types/crypto-js": "^3.1.33",
        "angular2-swing": "^0.12.1",
        "cordova-android": "^6.2.2",
        "cordova-ios": "^4.5.1",
        "cordova-plugin-actionsheet": "^2.3.3",
        "cordova-plugin-appavailability": "^0.4.2",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-contacts": "^2.3.1",
        "cordova-plugin-device": "^1.1.6",
        "cordova-plugin-dialogs": "^1.3.3",
        "cordova-plugin-facebook4": "^1.7.4",
        "cordova-plugin-file": "^4.3.3",
        "cordova-plugin-geolocation": "^2.4.3",
        "cordova-plugin-globalization": "^1.0.7",
        "cordova-plugin-googleplus": "^5.1.1",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-linkedin": "^1.2.1",
        "cordova-plugin-network-information": "^1.3.3",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.3",
        "cordova-plugin-whitelist": "^1.3.2",
        "cordova-plugin-x-socialsharing": "^5.1.8",
        "cordova-sqlite-storage": "^2.0.4",
        "cropperjs": "^1.0.0-alpha",
        "crypto-js": "^3.1.9-1",
        "es6-promise-plugin": "^4.1.1",
        "ionic-angular": "3.9.2",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "ng2-translate": "^5.0.0",
        "phonegap-plugin-barcodescanner": "^6.0.8",
        "phonegap-plugin-push": "^2.0.0",
        "qrcode-generator": "^1.0.7",
        "rxjs": "5.5.2",
        "sw-toolbox": "3.6.0",
        "uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.0.5",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@ionic/app-scripts": "3.1.0",
        "typescript": "~2.4.2"
    },

TO build I use command:

ionic cordova run android --prod

Before I just used ionic run android --prod

What is strange is that after the 10 minutes of build when I start my app it takes 15 seconds to start (like a normal build).
Here are the logs:

vendor.js:3916 Angular is running in the development mode. Call enableProdMode() to enable the production mode.
main.js:18000 Home displayed
main.js:18045 Not authenticated so redirect to connection
cordova.js:1223 deviceready has not fired after 5 seconds.
vendor.js:164568 Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
(anonymous) @ vendor.js:164568
t.invokeTask @ polyfills.js:3
r.runTask @ polyfills.js:3
e.invokeTask @ polyfills.js:3
i.isUsingGlobalCallback.invoke @ polyfills.js:3
n @ polyfills.js:3
vendor.js:164563 Ionic Native: deviceready event fired after 14300 ms

But what I don’t understand is why the plugins are impacted? Ionic is supposed to be a wrapper? And when I launch the same build on my project in ionic 2 (I kept a backup). Device fire in less than 4 seconds.

Do you have any idea?

Regards


#2

Solution found. The advice was correct. Uninstalled everything and reinstall everything and it was ok