简体   繁体   English

Cordova启动画面未隐藏在Android设备上,但应用程序在Chrome Webview中正常运行

[英]Cordova splash screen not hiding on android device but app is working fine in Chrome webview

When running my Ionic 3 application on my Android (6.0.1) device, the app is stuck on Cordova splash screen, although I can use it through Chrome WebView (and it works just fine). 在Android(6.0.1)设备上运行Ionic 3应用程序时,该应用程序卡在了Cordova初始屏幕上,尽管我可以通过Chrome WebView使用它 (而且效果很好)。

To make it even weirder the problem does not appear the first time I run the app after installing it, only after I close it and run it again (back button or swipe from task list). 为了使其更加奇怪,只有在我关闭应用程序并再次运行它(返回按钮或从任务列表中滑动)之后,才在我第一次安装该应用程序后才出现该问题。

Of course there is no error in the Chrome WebView console. 当然, Chrome WebView控制台中没有错误。 I also tried to run: 我还尝试运行:
navigator.splashscreen.hide();
in the console it does not work. 在控制台中不起作用。

Digging more 挖掘更多

What I realized also is that any preference I set in config.xml regarding the splash screen is ignored when the problem happens. 我还意识到,当问题发生时,我在config.xml设置的有关启动屏幕的任何首选项都会被忽略。 For example on first run: 例如在第一次运行时:
<preference name="ShowSplashScreenSpinner" value="false" />
does work properly, there is no spinner and the splash screen hides after some time. 确实可以正常工作,没有微调器,并且启动屏幕在一段时间后隐藏。 If I run: 如果我运行:
navigator.splashscreen.show();
in the console the splash screen shows again, and .hide() does hide it. 在控制台中,初始屏幕再次显示, .hide()确实将其隐藏。

On subsequent runs the spinner shows regardless of the preference. 在后续运行中,微调器将显示,而不管其偏好如何。 Also even weirder: 甚至更奇怪:
navigator.splashscreen.show();
does show the splash screen without spinner (on top of the existing one I guess), and .hide() goes back to the splash screen with spinner. 确实显示了没有微调器的启动屏幕(我猜是在现有的屏幕上),并且.hide()返回到带微调器的启动屏幕。

What I tried so far without success: 到目前为止我没有成功尝试过的东西:

  • npm install -g cordova@latest
  • npm install -g ionic@latest
  • Updated dependencies in package.json to latest versions 将package.json中的依赖项更新为最新版本
  • Remove node_modules and platform folder & run npm install again 删除node_modules和平台文件夹并再次运行npm install
  • Run cordova platform rm android && cordova platform add android 运行cordova platform rm android && cordova platform add android
  • Delete package-lock.json and run npm install again 删除package-lock.json并再次运行npm install
  • Removed the splash screen plugin completely from my code, Cordova and package.json (and removed node_modules & platform folders), but the splash screen of death still shows! 从我的代码Cordovapackage.json完全删除了启动屏幕插件(并删除了node_modules和平台文件夹),但是仍然显示死亡的启动屏幕!

Here is my environment: 这是我的环境:

cli packages:
    @ionic/cli-utils  : 1.13.1
    ionic (Ionic CLI) : 3.13.2
global packages:
    cordova (Cordova CLI) : 7.1.0
local packages:
    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.7.1
System:
    Android SDK Tools : 26.1.1
    Node              : v7.2.0
    npm               : 5.5.1
    OS                : Windows 10

And my package.json and config.xml if it helps. 还有我的package.jsonconfig.xml(如果有帮助的话)。

Any ideas? 有任何想法吗?

After starting from a new project, copying my src/ folder, carefully installing all plugins and testing the app I found out that the issue was caused by Ionic Pro plugin. 从新项目开始后,复制我的src/文件夹,仔细安装所有插件并测试应用程序,我发现问题是由Ionic Pro插件引起的。

The following fixed it: ionic cordova plugin rm cordova-plugin-ionic --save 修复了以下问题: ionic cordova plugin rm cordova-plugin-ionic --save

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM