⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)
QtQuick app startup performance issue on Android: startup takes half a minute after app shows up
So I have made a QtQuick Android application which takes too long for the startup. Here is a snippet from the startup log:
@D/libEGL ( 7332): loaded /system/lib/egl/libEGL_MRVL.so
D/libEGL ( 7332): loaded /system/lib/egl/libGLESv1_CM_MRVL.so
D/libEGL ( 7332): loaded /system/lib/egl/libGLESv2_MRVL.so
D/GC ( 7332): <tid=7332> OES20 ===> GC Version : MMP3_MK2_ICS_Beta2_RC4_GC10
D/GC ( 7332):
D/OpenGLRenderer( 7332): Enabling debug mode 0
=== app shows up with blackscreen - but about 30 seconds nothing happens
D/GC ( 7332): <tid=7350> OES20 ===> GC Version : MMP3_MK2_ICS_Beta2_RC4_GC10
D/GC ( 7332):
=== apps first screen shows up@
Do you have any idea what can cause this issue? A simple hello world app starts instantly.
Btw: On the linux mint desktop my app starts also instantly. So it is just an Android problem.
- Linux mint 64bit
- Android 4.0.3 Tablet
- Bundling Qt libraries in APK
- Qt 5.2
Loading of all Qt Quick items at startup can be very long on mobile devices (Android and iOS).
So, what it is loaded instantly on desktop machine may take even some minutes on the mobile devices.
There are various tricks that you should take into account for speed-up application on mobile devices.
I use the following:
- I use a splash screen to notify the user that something is loading. In this way the user are willing to wait until 10 seconds because they see something running (like a cool animation). Search on my posts on how to create a splash screen with QML
- Don't create big QML files. When I reach 200 lines of code, I'll start to split the code into different QML files
- Try to modularize your QML code as much as possible, because if you have two QML files that are almost identically they still have to 'compiled' twice, while if you create one that with a parameter behaves for both, Qt 'compile' it only once (on mobile devices the compilation of QML files is the most heavy part)
- Do not load all items. Use StackView, ListView and other Qt Quick items that allow you to create items only when they need to be displayed
- Following the previous point, find out which is the most complex and slow pages to display and do a fake loading during the splash screen, so the 'compilation' time occurs only during the splash screen where users can wait longer
Thanks for your tips :) Going to optimize my app.
But still there is one things that bothers me: It hasnt grown (lines of code) that much in a period, while I didnt deploy it on the android device. And before that period it was almost instantly up (about 2 secs) and after it took so long. So I thought there could be something special that could cause such a big pause.
For my experience one of the most heavy item is "Text" !! Especially if it has to be render long rich text and it is inside QtQuick.Layouts (that they are heavy too).
Good to know. I dont use Layouts, but many Text elements.
So, we are almost in the same situations.
For example, there is a screen where I have to show the "Terms, Conditions & Privacy" of the app. And, if I try to load all text in one Text items the app make minutes to load.
I'm still trying to find out a way to speed-up.
If I'll find, I'll post here.
Just an update:
While optimizing the app didnt help much, switching from 5.2.1 to 5.3 made a huge difference in startup time. From ~30 seconds to 3 seconds.
Etchelon last edited by
Add your QML files to a Resource file, helped a lot here.
digithree last edited by
I came across this same problem but not related to the Qt platform, it is happening with Cocos2Dx. I just wanted to post that it is not a Qt problem, to do with adding to many UI components at once, etc., it's some of kind OpenGL problem which seems to be only affecting some Samsung devices like the Tab 4. You correctly noted that your app is stalling when loading the shared libraries (.so files) for OpenGL.
If I find out how to fix it I'll post here.