Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-124786

[Android] NullPointerException at QtActivityDelegate.java:83

    XMLWordPrintable

Details

    • Android
    • 7602f71aa (dev), fcae2b7f2 (6.8), a0a2a8340 (6.7)
    • 2024wk18FOQtforAndroid, 2024wk20s2FOQtforAndroid, 2024wk22s2FOQtforAndroid, 2024wk24s2FOQtforAndroid

    Description

      I've just started updating my apps to Qt 6.7 and I have started seeing a lot of NullPointerException at QtActivityDelegate.java:83 in the Google Play Console.

      Apparently m_layout is null when the activity is being restarted.

       

      QtActivityDelegate.java
          @Override
          public boolean updateActivityAfterRestart(Activity activity) {
              boolean updated = super.updateActivityAfterRestart(activity);
              // TODO verify whether this is even needed, the last I checked the initMembers
              // recreates the layout anyway
              // update the new activity content view to old layout
              ViewGroup layoutParent = (ViewGroup)m_layout.getParent();
              if (layoutParent != null)
                  layoutParent.removeView(m_layout);
              m_activity.setContentView(m_layout);
              return updated;
          }
      

       

      I haven't been able to reproduce it. However here is the full stack trace from the Google Play Console.

      Exception java.lang.RuntimeException:
        at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3537)
        at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3692)
        at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:140)
        at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:100)
        at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2235)
        at android.os.Handler.dispatchMessage (Handler.java:107)
        at android.os.Looper.loop (Looper.java:240)
        at android.app.ActivityThread.main (ActivityThread.java:7829)
        at java.lang.reflect.Method.invoke
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:512)
        at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1027)
      Caused by java.lang.NullPointerException:
        at org.qtproject.qt.android.QtActivityDelegate.updateActivityAfterRestart (QtActivityDelegate.java:83)
        at org.qtproject.qt.android.QtActivityBase.handleActivityRestart (QtActivityBase.java:68)
        at org.qtproject.qt.android.QtActivityBase.onCreate (QtActivityBase.java:99)
        at org.qtproject.qt.android.bindings.QtActivity.onCreate (QtActivity.java:16)
        at org.qtproject.qt.android.bindings.MyQtActivity.onCreate (MyQtActivity.java:369)
        at android.app.Activity.performCreate (Activity.java:7980)
        at android.app.Activity.performCreate (Activity.java:7969)
        at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1306)
        at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3508)

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              assam Assam Boudjelthia
              adrian.gabureanu Adrian Gabureanu
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes