Does not compile with Qt6.2
See original GitHub issueAlthough Qt6.2 now supports the equivalent functionality of Qt5’s “androidextras” package, I note no ifdefs in the source code for supporting Qt6.2, resulting in compilation errors like:
18:14:47: Running steps for project QtAndroidToolsDemo...
18:14:48: Starting: "/opt/QtCo/6.2.0/android_arm64_v8a/bin/qmake" /usr/local/src/QtAndroidTools/QtAndroidToolsDemo/QtAndroidToolsDemo.pro -spec android-clang CONFIG+=qtquickcompiler
Project ERROR: Unknown module(s) in QT: androidextras
18:14:48: The process "/opt/QtCo/6.2.0/android_arm64_v8a/bin/qmake" exited with code 3.
Error while building/deploying project QtAndroidToolsDemo (kit: Android Qt 6.2.0 Clang arm64-v8a)
When executing step "qmake"
Although I started replacing headers, and qmake files to prevent this, e.g. for QtAndroidTools.pri:
equals(QT_MAJOR_VERSION, 6):greaterThan(QT_MINOR_VERSION,1) {
## For Qt6.2, AndroidExtras is now part of QtCore
}
else:equals(QT_MAJOR_VERSION, 5) {
QT += androidextras ##Qt5 only
}
else { ##Functionality not available at all in Qt 6.0, 6.1
error("Qt$$QT_VERSION is unsupported... (Qt5, or Qt>=6.2 are supported).")
}
And for various .h files:
#if (QT_VERSION < 0x060000) //Qt5
#include <QtAndroidExtras>
#elif (QT_VERSION < 0x060200)
//Qt6.0, 6.1 are unsupported...
#elif (QT_VERSION >= 0x060200) //Qt6.2
#include <QCoreApplication> //Qt>=6.2 QAndroidJniEnvironment and QAndroidJniObject in QCore
#endif /* (QT_VERSION < 0x060000) */
I noticed I would soon be wading into a sea of ifdefs if i continued, e.g. each instance of QtAndroid::androidSdkVersion() becomes QNativeInterface::QAndroidApplication::sdkVersion() for 6.2
So I was wondering if I am duplicating work or if there are plans to support Qt6.2 now that the beta is available to see if such functionality will work for future open-source Android apps?
For example to cleanly handle such trivial API changes as above, perhaps define a common QTAT_QTANDROID which is defined as QNativeInterface::QAndroidApplication
for 6.2 and QtAndroid
for Qt5 and then replace all QtAndroid::androidSdkVersion()
with QTAT_QTANDROID::androidSdkVersion()
??
For details see: https://doc-snapshots.qt.io/qt6-dev/qnativeinterface-qandroidapplication.html https://bugreports.qt.io/browse/QTBUG-89482 https://bugreports.qt.io/browse/QTBUG-84382 https://github.com/qt/qtandroidextras
Issue Analytics
- State:
- Created 2 years ago
- Comments:23 (10 by maintainers)
Top GitHub Comments
this one is fixed in Qt 6.2.2
I start introducing Qt6 support