Qt android app black screen after splashscreen
-
Hi everyone, when i run qt quick application on android it's showing black screen after splashscreen. Can someone help me?
-
@MVS-VARA-PRASAD How do you add your splash screen?
-
@JoeCFD This is my themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Myapp" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#ffff80</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/logo</item>
<item name="android:windowSplashScreenAnimationDuration">100</item>
<item name="postSplashScreenTheme">@style/Theme.Myapp</item>
</style>
</resources>
I used latest android splashscreen. -
@MVS-VARA-PRASAD I am not sure about this one. Since my splash widget is customized, I did it differently and do not have black screen.
I used two loaders to load splash qml and main qml one after another with a timer. -
S SGaist moved this topic from Wiki Discussion on
-
@MVS-VARA-PRASAD I thought the problem was due to qt rhi. When i used qputenv("QT_QUICK_BACKEND","software"); the app loaded without blackscreen but due to software renderer qt quick controls didn't get rendered properly. I even tested out
qputenv("QSG_RHI_BACKEND","opengl");
qputenv("QSG_RENDER_LOOP","threaded");
but there is no use.
Does anyone know how to solve this? -
@MVS-VARA-PRASAD I used sticky splash screen and added #include <QCoreApplication> and QNativeInterface::QAndroidApplication::hideSplashScreen(0); in main.cpp and there is no blackscreen after splashscreen.
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QCoreApplication>int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);QQmlApplicationEngine engine; const QUrl url(u"qrc:/TestSplash/Main.qml"_qs); QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url);
#if defined(Q_OS_ANDROID)
QNativeInterface::QAndroidApplication::hideSplashScreen(0);
#endif
return app.exec();}
You can modify drawable/splashScreen to change splashscreen background color . -
-
@MVS-VARA-PRASAD
Remove the first item shape tag in drawable/splashscreen to avoid logo showing after splashscreen and set bitmap item color to system, define this color tag in colors.xml<color name="system">?android:attr/colorBackground</color>
which gets the system color or set your own color. Finally set the hidesplashscreen in main.cpp to 1000 to have fade effect.
QNativeInterface::QAndroidApplication::hideSplashScreen(1000);Make sure to use sticky splashscreen.