2 Commits

Author SHA1 Message Date
e7b95be255 android - add include path 2024-11-12 15:49:33 -05:00
b13132feea AndroidNDS - fix Android building with Qt6.7
QNativeInterface does not provide source compatibility.  context() return
type changed.

https://bugreports.qt.io/browse/QTBUG-123900

Solution contributed by https://github.com/0xFEEDC0DE64 in
https://github.com/jbagg/QtZeroConf/pull/68
2024-06-28 10:45:52 -04:00
2 changed files with 5 additions and 1 deletions

View File

@ -59,8 +59,11 @@ QZeroConfPrivate::QZeroConfPrivate(QZeroConf *parent)
// Note: needs to be quint64 as uintptr_t might be 32 or 64 bit depending on the system, while Java expects a jlong which is always 64 bit.
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
nsdManager = QAndroidJniObject("qtzeroconf/QZeroConfNsdManager", "(JLandroid/content/Context;)V", reinterpret_cast<quint64>(this), QtAndroid::androidActivity().object());
#else
#elif (QT_VERSION < QT_VERSION_CHECK(6, 7, 0))
nsdManager = QAndroidJniObject("qtzeroconf/QZeroConfNsdManager", "(JLandroid/content/Context;)V", reinterpret_cast<quint64>(this), QNativeInterface::QAndroidApplication::context());
#else
// QNativeInterface does not provide source compatibility. https://bugreports.qt.io/browse/QTBUG-123900 https://forum.qt.io/topic/157493/binary-and-source-compatibility-breakage-in-6-7
nsdManager = QAndroidJniObject("qtzeroconf/QZeroConfNsdManager", "(JLandroid/content/Context;)V", reinterpret_cast<quint64>(this), QNativeInterface::QAndroidApplication::context().object<jobject>());
#endif
if (nsdManager.isValid()) {
jclass objectClass = env->GetObjectClass(nsdManager.object<jobject>());

View File

@ -126,6 +126,7 @@ android: {
QT += androidextras
}
QT += gui
INCLUDEPATH += $$PWD
HEADERS += $$PWD/qzeroconf.h $$PWD/androidnsd_p.h
SOURCES += $$PWD/androidnsd.cpp
DISTFILES += $$PWD/QZeroConfNsdManager.java