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

Evaluate the need to initClasses in Java code and QtLoader

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • P2: Important
    • 6.8.0, 6.9.0 FF
    • 6.8
    • QPA: Android
    • None
    • Android
    • 5cf2538b9 (dev), 8e38a6ffc (6.8), 599dbb7d8 (dev), abccd9387 (6.8), 025020adf (dev), b110428cb (6.8), b241baa06 (dev), 585187f90 (6.8), c6ac461ed (dev)
    • 2024wk32s2FOQtforAndroid, 2024wk34s2FOQtforAndroid

    Description

      Qt for Android have these mechanism to set the context to Java static classes used by various modules, where the QtLoader tries to look for setContext(Context), setActivity(Activity) and setService(Service) methods defined under certain modules where it uses reflection to for example assign the context to them before actually loading their respective shared libraries where some initialization is needed and requires the context to be already set.

      This logic requires the following:

      • The class defining those methods needs to be public
      • The classes need to be defined under CMakeLists.txt for the respective module
      • That info is passed to the Qt installation
      • androiddeployqt passes that info through deployment to resources

      Now, I'm thinking that this mechanism is not really necessary, since Qt Core is going to be loaded first anyways (or at least we can ensure that if that's not the case now), and then make sure to init the context, if needed, under JNI_OnLoad() instead of those static classes and through reflection which requires the class to be public.

      Relevant links:

      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
              assam Assam Boudjelthia
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: