question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not compile with Qt6.2

See original GitHub issue

Although 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:open
  • Created 2 years ago
  • Comments:23 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
ssakonecommented, Feb 1, 2022

Well, while I can reach you, I want to ask. I left a comment under the blog post, but I guess you didn’t see it. How can I do what you describe in your blog for Qt 6.2?

I’m so sorry if I’m doing it wrong by asking this here, it can be deleted from anyone.

QML: Resize controls when Android virtual keyboard come up

this one is fixed in Qt 6.2.2

2reactions
ssakonecommented, Feb 1, 2022

I start introducing Qt6 support

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build System Changes in Qt 6 | Qt 6.4
While qmake is still supported for building Qt applications, it can no longer be used to compile custom Qt plugins, or libraries that...
Read more >
Building Qt 6 from Git - Qt Wiki
This article provides hints for checking out and building the Qt 6 repositories. This is primarily for developers who want to contribute to ......
Read more >
Error on Qt 6 Building from source for Windows Based
is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Qt/Qt-6/CMakeFiles/CMakeTmp.
Read more >
Qt for Windows - Building from Source | Qt 6.4
This avoids issues with too long file paths in the compilation phase. Step 2: Install Build Requirements. To build Qt from sources you...
Read more >
Qt Configure Options | Qt 6.5 - Qt Documentation Snapshots
Since Qt 6, configure is a wrapper around cmake. ... and QT_BUILD_TOOLS_BY_DEFAULT to OFF, the respective parts will not be built by cmake...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found