android - 使用 --prod 和 --release 构建 Ionic 3 Angular 4 应用程序时出现空白屏幕

标签 android cordova ionic-framework apk

我见过很多人遇到与我类似的问题,但我看到的解决方案都不能帮助我,所以我不会重复已经提出的问题。

我有这样的环境: cli 包:(/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

全局包:

cordova (Cordova CLI) : 7.1.0

本地包:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 6.3.0 ios 4.4.0
Ionic Framework    : ionic-angular 3.9.2

系统:

ios-deploy : 1.9.1
ios-sim    : 5.0.12
Node       : v7.0.0
npm        : 5.3.0
OS         : macOS High Sierra
Xcode      : Xcode 9.2 Build version 9C40b

我有这些插件:

com.googlemaps.ios 2.5.0 "Google Maps SDK for iOS"
cordova-plugin-add-swift-support 1.7.0 "AddSwiftSupport"
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-crosswalk-webview 2.3.0 "Crosswalk WebView Engine"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-mauron85-background-geolocation 2.3.2 "CDVBackgroundGeolocation"
cordova-plugin-nativegeocoder 2.0.4 "NativeGeocoder"
cordova-plugin-network-information 1.3.4 "Network Information"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-swift-support 3.1.1 "SwiftSupport"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sqlite-storage 0.7.14 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-barcodescanner 7.0.1 "BarcodeScanner"

当我检查时: % sudo ionic doctor 检查

✔ Detecting issues: 16 / 16 complete - done! [OK] Detected 0 issues. Aww yeah! 💪

当我使用此命令运行应用程序时,它运行良好,我看到空白屏幕,但几秒钟后它会转到我的登录页面:

% sudo ionic cordova run android -l -c

但是,如果我尝试构建生产/发布版本,我会在使用微调器隐藏启动屏幕后立即看到空白屏幕:

% sudo ionic cordova run android --prod --release

我想知道是否与白名单插件和权限有关,是吗?但什么?

正如你所看到的,我正在使用 Crosswalk,是否有与之相关的东西?

这两个命令之间的真正区别是什么?当我使用 --prod--release 时,我可以做什么来了解到底发生了什么?

最佳答案

导致这个巨大问题的原因是我的 tsconfig.json 中存在:

"target": "es6"

因为我被告知设置为 6 来使用异步和等待,但我可以这样设置:

"target": "es5"

并使用Typescript 2.7.1 - 我花了 5 天的时间来解决这个问题,才发现这个目标导致了这个恼人的黑屏。

我希望这可以帮助其他人。

关于android - 使用 --prod 和 --release 构建 Ionic 3 Angular 4 应用程序时出现空白屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48627642/

相关文章:

java - Android中TextView的Resource NotFound异常

android - 当 startAngle > endAngle 在 android 中时,drawArc 无法正确绘制

javascript - 从 Firebase 读取数据并放入数组中

javascript - 使用设备 IP 地址查找位置

java - 即使将其可见性设置为 true,按钮 View 也不可见

android - commitAllowingStateLoss() 和 commit() fragment

javascript - OOP -executeSql 将结果返回到 var 中,它显示未定义

javascript - 在 cordova 项目中检查 native android 浏览器中的 WebSocket 支持

android - Facebook 评论 api phonegap

ios - 已弃用尝试访问非导航器对象上的属性 'userAgent'