科尔多瓦(Cordova),Android,加载速度异常慢 [英] Cordova, Android, incredibly slow loading

查看:90
本文介绍了科尔多瓦(Cordova),Android,加载速度异常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行Cordova CLI 6.4.0的Cordova应用程序.在加载过程中,启动屏幕之后有一个空白的白色屏幕,在加载时会持续显示4-6秒钟.在应用程序重新加载过程中也会发生同样的事情.在platform.ready事件之前或之内,不会从应用触发任何事件.搜索之后,人们似乎在解决类似问题方面取得了一些成功,所有问题都围绕在初始屏幕下方的配置选项周围,但没有任何建议或想法起作用.

I have a Cordova app running Cordova CLI 6.4.0. During load, there is a blank white screen for a solid 4-6 seconds on load after the splash screen. This same thing happens during app reload. No events fire from the app, either before or inside platform.ready event. After searching there seems to be some success by people for similar issues, all centered around the splash screen the below config options, none of the suggestions or ideas have worked.

更新

我似乎已经取得了一些进展,我想我对这里正在发生的事情了解得更多.在这里的另一篇文章中,我在config.xml中添加了以下几行

I seem to have made some progress and I think I understand more of what's going on here. Per another post here I added the below lines to my config.xml

<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000"/>

具有这两个功能,现在的行为是显示了启动画面"(很长一段时间,通常为9秒左右),然后启动画面消失了,我的应用加载了.因此,这不再是邪恶的白屏,而是加载应用程序的缓慢问题,这是我的问题.

The behavior now, with those two, is that the Splash Screen is displayed (for a long time, usually around 9 seconds), then the Splash goes away and my app loads. So it's no longer a white screen of evil but just a very slow to load app that is my problem.

/更新

启动屏幕-> 4-6秒空白白屏->然后,应用程序加载并启动deviceReady. SplashScreenDelay = 2000会发生这种情况

Splash Screen -> 4-6 seconds blank white screen -> Then the app loads and deviceReady fires. This happens with SplashScreenDelay=2000

否则它将完全不显示启动屏幕,而是在加载应用程序之前有8-9秒的空白白屏.这发生在SplashScreenDelay = 0

Or it will not show the splash screen at all and instead have 8-9 seconds of the blank white screen before the app loads. This happens with SplashScreenDelay=0

我在主应用程序的构造函数中和platform.ready上都具有console.logs,直到死机白屏被解决并消失后,这两个命令都无法启动.

I have console.logs in my main app's constructor and on platform.ready, neither fire until the white screen of doom is resolved and gone away.

我尝试了以下选项

<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="2000" />

<preference name="SplashScreenDelay" value="0" />

这非常令人困惑,因为实际上并不是我的应用程序运行缓慢...它只是加载位,启动页面和应用程序加载之间出现空白白屏,然后再进行其他操作.我愿意尝试任何想法,因为在这种状态下基本上是无法发布的.

It's very confusing because it's not actually my app that's being slow... it's just the loading bits, with a blank white screen between the splash page and app load before anything else happens. I'm open to trying out any ideas as it's basically un-releasable in this state.

在iOS上根本不会发生这种情况,因为构建和设置都相同,这是Android的特定问题.我正在运行的设备是Moto E2.

This does not happen at all on iOS, with the build and settings all identical, it's an Android specific issue. The device I am running on is a Moto E2.

我正在使用Ionic,下面是其中包含的插件的列表,因为这似乎是当前最有可能的罪魁祸首.我将不得不在没有某些插件的情况下测试所有内容,以查看其性能.

I am using Ionic and below is a list of included plugins, as it seems that's the most likely culprit at this time. I will have to test everything out without certain plugins to see how it performs.

cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-facebook4 1.7.4 "Facebook Connect"
cordova-plugin-splashscreen 4.0.1 "Splashscreen"
cordova-plugin-statusbar 2.2.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

这是我的完整图标/飞溅定义.

And here's my full icon/splash definitions.

<platform name="android">
    <allow-intent href="market:*" />
    <icon platform="android" src="resources/icon.png" />
    <icon platform="android" qualifier="ldpi" src="resources/icons/android/icon-36-ldpi.png" />
    <icon platform="android" qualifier="mdpi" src="resources/icons/android/icon-48-mdpi.png" />
    <icon platform="android" qualifier="hdpi" src="resources/icons/android/icon-72-hdpi.png" />
    <icon platform="android" qualifier="xhdpi" src="resources/icons/android/icon-96-xhdpi.png" />
    <icon platform="android" qualifier="xxhdpi" src="resources/icons/android/icon-144-xxhdpi.png" />
    <icon platform="android" qualifier="xxxhdpi" src="resources/icons/android/icon-192-xxxhdpi.png" />
    <splash platform="android" src="resources/splash.png" />
    <splash platform="android" qualifier="ldpi" src="resources/screens/android/screen-ldpi-portrait.png" />
    <splash platform="android" qualifier="mdpi" src="resources/screens/android/screen-mdpi-portrait.png" />
    <splash platform="android" qualifier="hdpi" src="resources/screens/android/screen-hdpi-portrait.png" />
    <splash platform="android" qualifier="xhdpi" src="resources/screens/android/screen-xhdpi-portrait.png" />
</platform>

推荐答案

找到了其他一些答案,但是我已经用下面的方法解决了

Found one some other SO answer, but I have solved with the below

<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000"/>

该应用仍然需要永久加载(通常需要9秒钟左右),但我至少避免了白屏废话.

The app still takes forever to load (usually around 9 seconds), but I avoid the white screen nonsense at least.

这篇关于科尔多瓦(Cordova),Android,加载速度异常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆