I run ionic cordova run android
for my Ionic Cordova project. At this time, I have my mobile connected to PC via USB. So when I run that command, it installs the app on my real device Android Redmi Note 6 PRO.
But what really happens is when the app opens, only white screen appears, nothing else at all. First it shows splash screen and then white screen forever. Why does this behaviour happen? I read somewhere that some people had this problem because of Ionic 4.
Below are my logcat logs from after I click the app to open on Android emulator (it shows white screen also on Android emulator).
2019-02-11 00:01:24.131 5945-5945/? I/zygote: Not late-enabling -Xcheck:jni (already on)
2019-02-11 00:01:24.148 5945-5945/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter I/CordovaLog: Changing log level to DEBUG(3)
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter I/CordovaActivity: Apache Cordova native platform version 7.1.4 is starting
2019-02-11 00:01:24.312 5945-5945/io.ionic.starter D/CordovaActivity: CordovaActivity.onCreate()
2019-02-11 00:01:24.342 5945-5945/io.ionic.starter I/WebViewFactory: Loading com.android.chrome version 61.0.3163.98 (code 316409812)
2019-02-11 00:01:24.350 5945-5945/io.ionic.starter I/zygote: The ClassLoaderContext is a special shared library.
2019-02-11 00:01:24.392 5945-5945/io.ionic.starter I/cr_LibraryLoader: Time to load native libraries: 8 ms (timestamps 2894-2902)
2019-02-11 00:01:24.421 5945-5945/io.ionic.starter I/chromium: [INFO:library_loader_hooks.cc(136)] Chromium logging enabled: level = 0, default verbosity = 0
2019-02-11 00:01:24.422 5945-5945/io.ionic.starter I/cr_LibraryLoader: Expected native library version number "61.0.3163.98", actual native library version number "61.0.3163.98"
2019-02-11 00:01:24.436 5945-5963/io.ionic.starter W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
2019-02-11 00:01:24.464 5945-5945/io.ionic.starter I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
2019-02-11 00:01:24.513 5945-5945/io.ionic.starter W/o.ionic.starter: type=1400 audit(0.0:48): avc: denied { read } for name="vmstat" dev="proc" ino=4026532039 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
2019-02-11 00:01:24.544 5945-5945/io.ionic.starter I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2019-02-11 00:01:24.553 5945-5945/io.ionic.starter D/EGL_emulation: eglCreateContext: 0xa4516160: maj 3 min 0 rcv 3
2019-02-11 00:01:24.555 5945-5945/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa4516160: ver 3 0 (tinfo 0x94123730)
2019-02-11 00:01:24.635 5945-5945/io.ionic.starter D/IonicWebViewEngine: Ionic Web View Engine Starting Right Up 1...
2019-02-11 00:01:24.659 5945-5945/io.ionic.starter D/SystemWebViewEngine: CordovaWebView is running on device made by: Google
2019-02-11 00:01:24.675 5945-5945/io.ionic.starter D/PluginManager: init()
2019-02-11 00:01:24.718 5945-5999/io.ionic.starter D/OpenGLRenderer: HWUI GL Pipeline
2019-02-11 00:01:24.787 5945-5945/io.ionic.starter D/CordovaWebViewImpl: >>> loadUrl(file:///android_asset/www/index.html)
2019-02-11 00:01:24.793 5945-5963/io.ionic.starter I/cr_LibraryLoader: Using linker: org.chromium.base.library_loader.ModernLinker
2019-02-11 00:01:24.795 5945-5992/io.ionic.starter W/cr_media: Requires BLUETOOTH permission
2019-02-11 00:01:24.800 5945-5945/io.ionic.starter D/CordovaActivity: Started the activity.
2019-02-11 00:01:24.805 5945-5945/io.ionic.starter D/CordovaActivity: Resumed the activity.
2019-02-11 00:01:24.834 5945-5999/io.ionic.starter I/OpenGLRenderer: Initialized EGL, version 1.4
2019-02-11 00:01:24.834 5945-5999/io.ionic.starter D/OpenGLRenderer: Swap behavior 1
2019-02-11 00:01:24.836 5945-5999/io.ionic.starter W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2019-02-11 00:01:24.836 5945-5999/io.ionic.starter D/OpenGLRenderer: Swap behavior 0
2019-02-11 00:01:24.856 5945-5999/io.ionic.starter D/EGL_emulation: eglCreateContext: 0xa48062c0: maj 3 min 0 rcv 3
2019-02-11 00:01:24.871 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.188 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.209 5945-6010/io.ionic.starter D/EGL_emulation: eglCreateContext: 0x94170560: maj 3 min 0 rcv 3
2019-02-11 00:01:25.212 5945-6010/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0x94170560: ver 3 0 (tinfo 0x92f2a180)
2019-02-11 00:01:25.302 5945-6010/io.ionic.starter I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
2019-02-11 00:01:25.302 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.313 5945-6010/io.ionic.starter W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
2019-02-11 00:01:25.372 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.450 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:25.458 5945-6010/io.ionic.starter D/EGL_emulation: eglCreateContext: 0x941716a0: maj 3 min 0 rcv 3
2019-02-11 00:01:25.460 5945-6010/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0x941716a0: ver 3 0 (tinfo 0x92f2a180)
2019-02-11 00:01:25.537 5945-6012/io.ionic.starter W/cr_CrashFileManager: /data/user/0/io.ionic.starter/cache/WebView/Crash Reports does not exist or is not a directory
2019-02-11 00:01:25.537 5945-5950/io.ionic.starter I/zygote: Do partial code cache collection, code=22KB, data=30KB
2019-02-11 00:01:25.541 5945-5950/io.ionic.starter I/zygote: After code cache collection, code=22KB, data=30KB
2019-02-11 00:01:25.541 5945-5950/io.ionic.starter I/zygote: Increasing code cache capacity to 128KB
2019-02-11 00:01:25.546 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageDidNavigate(file:///android_asset/www/index.html)
2019-02-11 00:01:25.611 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageFinished(file:///android_asset/www/index.html)
2019-02-11 00:01:25.619 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageDidNavigate(http://localhost/)
2019-02-11 00:01:25.619 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/
2019-02-11 00:01:25.640 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/runtime.js
2019-02-11 00:01:25.641 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/polyfills.js
2019-02-11 00:01:25.644 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/styles.js
2019-02-11 00:01:25.645 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/cordova.js
2019-02-11 00:01:25.646 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/vendor.js
2019-02-11 00:01:25.647 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/main.js
2019-02-11 00:01:25.663 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/: Line 10 : The key "viewport-fit" is not recognized and ignored.
2019-02-11 00:01:25.663 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(10)] "The key "viewport-fit" is not recognized and ignored.", source: http://localhost/ (10)
2019-02-11 00:01:25.997 5945-5991/io.ionic.starter E/chromium: [ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: blink::mojom::BudgetService exposed by: content_browser
2019-02-11 00:01:26.012 5945-5945/io.ionic.starter D/JsMessageQueue: Set native->JS mode to EvalBridgeMode
2019-02-11 00:01:26.083 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/cordova_plugins.js
2019-02-11 00:01:26.101 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-statusbar/www/statusbar.js
2019-02-11 00:01:26.102 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-device/www/device.js
2019-02-11 00:01:26.106 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-splashscreen/www/splashscreen.js
2019-02-11 00:01:26.107 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-ionic-webview/src/www/util.js
2019-02-11 00:01:26.108 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/plugins/cordova-plugin-ionic-keyboard/www/android/keyboard.js
2019-02-11 00:01:26.201 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:26.213 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:26.268 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.505 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.812 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.826 5945-5999/io.ionic.starter D/EGL_emulation: eglMakeCurrent: 0xa48062c0: ver 3 0 (tinfo 0xa48038d0)
2019-02-11 00:01:27.878 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.887 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/main.js: Line 3385 : TypeError: Cannot read property 'apply' of null
2019-02-11 00:01:27.887 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(3385)] "TypeError: Cannot read property 'apply' of null", source: http://localhost/main.js (3385)
2019-02-11 00:01:27.894 5945-5945/io.ionic.starter D/SystemWebChromeClient: http://localhost/vendor.js: Line 75947 : Ionic Native: deviceready event fired after 973 ms
2019-02-11 00:01:27.895 5945-5945/io.ionic.starter I/chromium: [INFO:CONSOLE(75947)] "Ionic Native: deviceready event fired after 973 ms", source: http://localhost/vendor.js (75947)
2019-02-11 00:01:27.896 5945-5988/io.ionic.starter D/SERVER: Handling local request: http://localhost/assets/icon/favicon.png
2019-02-11 00:01:27.916 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:27.924 5945-5945/io.ionic.starter D/CordovaWebViewImpl: onPageFinished(http://localhost/)
2019-02-11 00:01:27.951 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
2019-02-11 00:01:28.063 5945-5945/io.ionic.starter I/chatty: uid=10080(io.ionic.starter) identical 3 lines
2019-02-11 00:01:28.110 5945-5945/io.ionic.starter W/zygote: Attempt to remove non-JNI local reference, dumping thread
Chrome debugger shows:
TypeError: Cannot read property 'apply' of null
at vendor.js:88820
at NgRedux.push../node_modules/ng2-redux/lib/components/ng-redux.js.NgRedux.configureStore (vendor.js:87925)
at new AppModule (main.js:1511)
at _createClass (vendor.js:56970)
at _createProviderInstance (vendor.js:56940)
at initNgModule (vendor.js:56873)
at new NgModuleRef_ (vendor.js:57600)
at createNgModuleRef (vendor.js:57589)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (vendor.js:59420)
at NgModuleFactory_.push../node_modules/@angular/core/fesm5/core.js.NgModuleFactory_.create (vendor.js:60124)
vendor.js:75947 Ionic Native: deviceready event fired after 776 ms
I’ve solved this issue by setting the correct parameters on config.xml
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashScreen" value="screen" />
<preference name="ShowSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="FadeSplashScreen" value="true" />
Then, on my platform.ready()
instruction all I do is Splashscreen.hide()
and after that run the project on android using.
ionic cordova run android