Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
6.8
-
None
-
-
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:
- QtLoader.initStaticClasses(): https://github.com/qt/qtbase/blob/b959b8f5ed537f530221e0174b723ea39a34cd58/src/android/jar/src/org/qtproject/qt/android/QtLoader.java#L143
- Defining the static init classes in CMakeLists.txt: https://github.com/search?q=org%3Aqt+%22jar%3Aorg%22&type=code
- Example of patch causing fail for QtLoader.initStaticClasses(), where a static init class was being made package-public instead of public https://codereview.qt-project.org/c/qt/qtconnectivity/+/568702
Attachments
Issue Links
- is required for
-
QTBUG-128104 QtSpatialAudio example not working on Android
- Closed
- resulted from
-
QTBUG-126371 Make internal Java implementation as package public only
- Closed
- mentioned in
-
Page Loading...