NavController.push does not open next page in release-apk

--- update 1 ---

It looks like a minification issue for prod build.

I can reproduce the error using ionic cordova build android --prod

to create apk and adb install

to push apk to android device. Error message:

main.js:1 ERROR Error: Uncaught (in promise): Error: No provider for t!
Error: No provider for t!
    at Error (native)
    at O (file:///android_asset/www/build/main.js:1:6087)
    at T (file:///android_asset/www/build/main.js:1:6346)
    at t._throwOrNull (file:///android_asset/www/build/main.js:3:5428)
    at t._getByKeyDefault (file:///android_asset/www/build/main.js:3:5761)
    at t._getByKey (file:///android_asset/www/build/main.js:3:5146)
    at t.get (file:///android_asset/www/build/main.js:3:3554)
    at e.get [as _Logger_81] (file:///android_asset/www/build/main.js:25:21486)

      

--- main thread ---

I have 3 lines of code behind a button. The code is attached at the end.

All 3-line functions work as expected in ionic serve

and ionic cordova run android

on a real Android device.

However the 3rd line doesn't work if the code / apk is:

1. built by `ionic cordova build android --prod --release`,  
2. published to google play store,
3. installed to the same android device.

      

This means it DubPage

does not open by pressing the button.

What I eliminated:

1. this.logger.log() does send data to logentries, i.e. `goToDub`
function is called succesfully.
2.  this.player.pause() does stop the html5 video player
3.  I have no idea how to debug `this.navCtrl.push()`. 
4. The only possible cause I can come up with is the lazy loading of `DubPage`, even though I dont quite believe it being the reason.

      

Any hints?

  goToDub() {
    this.logger.log(JSON.stringify(this.video)); //send log to 3rd party cloud log service: logentries
    this.player.pause(); // stop html5 video player video.js in the page
    this.navCtrl.push("DubPage", { video: this.video }); // go to DubPage does NOT work in play store released apk version;
  }

      

In adding my package.json

{
    "name": "dubwork",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.1.2",
        "@angular/compiler": "4.1.2",
        "@angular/compiler-cli": "4.1.2",
        "@angular/core": "4.1.2",
        "@angular/forms": "4.1.2",
        "@angular/http": "4.1.2",
        "@angular/platform-browser": "4.1.2",
        "@angular/platform-browser-dynamic": "4.1.2",
        "@ionic-native/camera": "3.10.2",
        "@ionic-native/core": "3.10.2",
        "@ionic-native/facebook": "^3.10.3",
        "@ionic-native/file": "^3.10.3",
        "@ionic-native/keyboard": "^3.10.3",
        "@ionic-native/media": "^3.10.3",
        "@ionic-native/splash-screen": "3.10.2",
        "@ionic-native/status-bar": "3.10.2",
        "@ionic-native/transfer": "^3.10.3",
        "@ionic/storage": "2.0.1",
        "angular2-logger": "^0.6.0",
        "angularfire2": "^4.0.0-rc.1",
        "cordova-android": "^6.2.3",
        "cordova-plugin-compat": "^1.1.0",
        "cordova-plugin-console": "^1.0.7",
        "cordova-plugin-crosswalk-webview": "^2.3.0",
        "cordova-plugin-device": "^1.1.6",
        "cordova-plugin-facebook4": "^1.9.1",
        "cordova-plugin-file": "^4.3.3",
        "cordova-plugin-file-transfer": "^1.6.3",
        "cordova-plugin-media": "^3.0.1",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.3",
        "cordova-plugin-whitelist": "^1.3.2",
        "cordova-plugin-wkwebview-engine": "git+https://github.com/driftyco/cordova-plugin-wkwebview-engine.git",
        "firebase": "^3.9.0",
        "ionic-angular": "3.3.0",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "5.1.1",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.11"
    },
    "devDependencies": {
        "@ionic/app-scripts": "1.3.7",
        "@ionic/cli-plugin-cordova": "1.4.0",
        "@ionic/cli-plugin-ionic-angular": "1.3.1",
        "typescript": "2.3.3"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-facebook4": {
                "APP_ID": "229997797493525",
                "APP_NAME": "dubLearn-mobile"
            },
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-crosswalk-webview": {
                "XWALK_VERSION": "23+",
                "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
                "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
                "XWALK_MODE": "embedded",
                "XWALK_MULTIPLEAPK": "true"
            },
            "cordova-plugin-wkwebview-engine": {},
            "cordova-plugin-media": {},
            "cordova-plugin-file-transfer": {}
        },
        "platforms": [
            "android"
        ]
    }
}

      

+3


source to share


1 answer


It turns out the error was caused by using only the angular2-logger package. logentries doesn't matter.

Steps to reproduce the problem:



  • Initialized start of the error recorder
  • npm install --save angular2 -logger
  • add angular2 -logger package to provider's app.module.ts
  • add angular2 -logger package to home.ts and log debug message
  • using android using ionic cord program the app opens in android device without error.
  • using android -prod using ionic cord program app shows promise t error
0


source







All Articles