---更新1 ---
它看起来像prod构建的最小化问题。
我可以使用ionic cordova build android --prod
创建apk并将adb install
推送到Android设备来重现错误。
错误消息是:
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)
---主线---
我在按钮后面有3行代码。代码附在最后。
所有3行功能在真实Android设备的ionic serve
和ionic cordova run android
中按预期工作。
但是,如果代码/ apk是:
,则第3行不起作用1. built by `ionic cordova build android --prod --release`,
2. published to google play store,
3. installed to the same android device.
这意味着单击按钮不会打开DubPage
。
我排除了什么问题:
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.
任何提示?
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;
}
另外,我的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"
]
}
}
答案 0 :(得分:0)
事实证明,错误是由单独使用angular2-logger软件包引起的。 logentries是无关紧要的。
重现问题的步骤: