Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt android app black screen after splashscreen

Qt android app black screen after splashscreen

Scheduled Pinned Locked Moved Solved Mobile and Embedded
8 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MVS VARA PRASAD
    wrote on last edited by
    #1

    Hi everyone, when i run qt quick application on android it's showing black screen after splashscreen. Can someone help me?
    Untitled video - Made with Clipchamp (3).gif

    JoeCFDJ 1 Reply Last reply
    0
    • M MVS VARA PRASAD

      Hi everyone, when i run qt quick application on android it's showing black screen after splashscreen. Can someone help me?
      Untitled video - Made with Clipchamp (3).gif

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #2

      @MVS-VARA-PRASAD How do you add your splash screen?

      M 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        @MVS-VARA-PRASAD How do you add your splash screen?

        M Offline
        M Offline
        MVS VARA PRASAD
        wrote on last edited by
        #3

        @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.

        JoeCFDJ 1 Reply Last reply
        0
        • M MVS VARA PRASAD

          @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.

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by
          #4

          @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.

          M 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @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.

            M Offline
            M Offline
            MVS VARA PRASAD
            wrote on last edited by
            #5

            @JoeCFD can you show me your splash and main qml files?

            M 1 Reply Last reply
            0
            • SGaistS SGaist moved this topic from Wiki Discussion on
            • M MVS VARA PRASAD

              @JoeCFD can you show me your splash and main qml files?

              M Offline
              M Offline
              MVS VARA PRASAD
              wrote on last edited by
              #6

              @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?

              M 1 Reply Last reply
              0
              • M MVS VARA PRASAD

                @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?

                M Offline
                M Offline
                MVS VARA PRASAD
                wrote on last edited by MVS VARA PRASAD
                #7

                @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 .

                M 1 Reply Last reply
                0
                • M MVS VARA PRASAD has marked this topic as solved on
                • M MVS VARA PRASAD

                  @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 .

                  M Offline
                  M Offline
                  MVS VARA PRASAD
                  wrote on last edited by MVS VARA PRASAD
                  #8

                  @MVS-VARA-PRASAD Screenshot (3).png
                  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.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved