Category Archives: QT

Applying a path that fixes a bug in QT 5.15.2

There was a bug in QT 5.15.2 that results in app crash on Android 5.1 and a patch:

Submodule qtbase contains modified content
diff --git a/qtbase/src/corelib/plugin/qlibrary_unix.cpp b/qtbase/src/corelib/plugin/qlibrary_unix.cpp
index a5c72f81d9..5cd21b67a4 100644
--- a/qtbase/src/corelib/plugin/qlibrary_unix.cpp
+++ b/qtbase/src/corelib/plugin/qlibrary_unix.cpp
@@ -243,10 +243,10 @@ bool QLibraryPrivate::load_sys()
             }
             if (hnd) {
                 using JniOnLoadPtr = jint (*)(JavaVM *vm, void *reserved);
-                JniOnLoadPtr jniOnLoad = reinterpret_cast<JniOnLoadPtr>(dlsym(pHnd, "JNI_OnLoad"));
+                JniOnLoadPtr jniOnLoad = reinterpret_cast<JniOnLoadPtr>(dlsym(hnd, "JNI_OnLoad"));
                 if (jniOnLoad && jniOnLoad(QtAndroidPrivate::javaVM(), nullptr) == JNI_ERR) {
                     dlclose(hnd);
-                    pHnd = nullptr;
+                    hnd = nullptr;
                 }
             }
 #endif

Looks like it was simply a typo and pHnd was replaced with hnd.

QT 5.15.3 where the bug was fixed is commercial so I applied the patch by myself (thanks to danilabagroff from stackoverflow.com):

(more…)

Building QT 6.1.0 for Android on Windows

Theoretically it can be:

git clone --recursive https://code.qt.io/qt/qt5.git --branch v6.1.0

or alternatively:

git clone https://code.qt.io/qt/qt5.git --branch v6.1.0
./init-repository --branch --module-subset=essential,qtandroidextras,qtsvg,qtquickcontrols2,qtgraphicaleffects,qtwebsockets,qtmultimedia

or

./init-repository --module-subset=all
(more…)

QT 5.15.2 app crashes on Android 5.1

My QT 5.15.2 app crashes on Android 5.1 with the following call stack:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Android/sdk_google_phone_x86_64/generic_x86_64:5.1.1/LMY48X/6402608:userdebug/test-keys'
Revision: '0'
ABI: 'x86_64'
pid: 3954, tid: 3998, name: qtMainLoopThrea  >>> net.geographx.LinesGame <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'art/runtime/mirror/art_method.cc:356] Check failed: !IsFastNative() int java.lang.Character.digitImpl!(int, int)'
    rax 0000000000000000  rbx 0000000000000f9e  rcx ffffffffffffffff  rdx 0000000000000006
    rsi 0000000000000f9e  rdi 0000000000000f72
    r8  0000000000000022  r9  0000000000000002  r10 0000000000000008  r11 0000000000000206
    r12 000000000000000b  r13 0000000000000006  r14 00007f747b51a000  r15 0000000000000051
    cs  0000000000000033  ss  000000000000002b
    rip 00007f7488099e37  rbp 00007f7467007b70  rsp 00007f74670063e8  eflags 0000000000000206
(more…)

Dragging a link from a browser to a QML app

When a link is dragged from a browser on Window 10 platform it contains the page title, but they did not make it accessible in QML:

import QtQuick 2.15
import QtQuick.Controls 2.15

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Scroll")
    id: root

    DropArea {
        id: dropArea;
        anchors.fill: parent
        onEntered: {
            root.color = "gray";
            drag.accept (Qt.LinkAction);
        }
(more…)

Publishing QT application in Apple App Store

I succeeded with building my app for iOS and my first step in publishing the app in App Store was opening generated .xcodeproj file in XCode, but XCode froze displaying rotating progress indicator and wait cursor.

(more…)

Compiling QT5.15.0 with OpenSSL support with MSVC2017 on Windows

First, I compiled and installed OpenSSL 1.1.1g in the same way as before:

set PERL_ROOT=E:\PFiles\Strawberry\perl\bin
set PATH=%PERL_ROOT%;%PATH%
set PATH=%PATH%;C:\PFiles\nasm-2.14.02-win64
perl Configure VC-WIN64A
set CL=/MP
nmake
nmake install
(more…)

Building QT 5.15.0 (everywhere) for Android on Windows

  • Install Android Studio with SDK and NDK API Level 28.
  • Install strawberry-perl-5.26.2.1-64bit.msi first (before mingw-w64-install.exe) to E:\PFiles
  • Install MinGW with mingw-w64-install.exe online installer. Select POSIX threads in the installer UI combobox, otherwise you will get:
  • Extract the sources from QT archive qt-everywhere-src-5.15.0.zip to E:\Qt\Qt5.15.0 and run the following script in QT root directory containing configure.bat:
(more…)

Running a QT app on MacOS

I was able to compile and debug my app on MacOS with QT Creator:

All C++ code compiled successfully, but something went wrong with OpenGLES shaders. It is probably because I included OpenGLES headers from a wrong place.

(more…)

QT app is deactivated incorrectly on Android 10 in Gesture mode

If I enable Gesture mode on an Android 10 emulator by tapping System->Gestures->System Navigation->Gesture Navigation and then deactivate my app by swiping and reactivate it back, I get the following in the log:

adb logcat | grep "\ Lines"
05-04 21:52:36.389 11794 11939 D Lines   : Squircle::aboutToQuit()
05-04 21:52:36.389 11794 11939 D Lines   : InterstitialAdWrapper clear() called.
05-04 21:52:36.392 11794 11939 D Lines   : InterstitialAdWrapper InterstitialAd destructor called.
05-04 21:52:36.393 11794 11939 D Lines   : Squircle destructor called.
05-04 21:52:36.396 11794 11939 W Lines   : exit app 0
...
05-04 21:52:37.032 11794 11939 D Lines   : OslSoundPool destructor
05-04 21:52:37.117  2040  2134 W InputDispatcher: channel '8474831 net.geographx.LinesGame/net.geographx.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-04 21:52:37.117  2040  2134 E InputDispatcher: channel '8474831 net.geographx.LinesGame/net.geographx.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-04 21:52:37.123  2040  3120 I WindowManager: WIN DEATH: Window{8474831 u0 net.geographx.LinesGame/net.geographx.MainActivity}
05-04 21:52:37.123  2040  3120 W InputDispatcher: Attempted to unregister already unregistered input channel '8474831 net.geographx.LinesGame/net.geographx.MainActivity (server)'
05-04 21:52:37.136  2040  3120 W ActivityManager: Scheduling restart of crashed service net.geographx.LinesGame/org.chromium.content.app.SandboxedProcessService0 in 1000ms
05-04 21:52:37.151  2040  2057 I ActivityManager: Process net.geographx.LinesGame (pid 11794) has died: cch CRE
05-04 21:52:38.034  2040  2057 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=net.geographx.LinesGame/net.geographx.MainActivity bnds=[37,882][238,1191]} from uid 10090
05-04 21:52:38.055  2040  2057 I chatty  : uid=1000(system) Binder:2040_2 identical 8 lines
05-04 21:52:38.099  2040  2072 I ActivityManager: Start proc 12702:net.geographx.LinesGame/u0a134 for activity {net.geographx.LinesGame/net.geographx.MainActivity}
05-04 21:52:38.101 12702 12702 W raphx.LinesGam: Unexpected CPU variant for X86 using defaults: x86
05-04 21:52:38.124 12702 12702 E raphx.LinesGam: Not starting debugger since process cannot load the jdwp agent.
...
05-04 21:52:38.966  2040  2069 I ActivityTaskManager: Displayed net.geographx.LinesGame/net.geographx.MainActivity: +931ms
05-04 21:52:39.062 12702 12826 D libLinesGameQt_x86.so: Translation file has been loaded successfully:  "LinesGame_en"
05-04 21:52:39.062 12702 12826 D Lines   : App version:  "2.5.11, #133"
05-04 21:52:39.072 12702 12826 D Lines   : QT/SysInfo: Device Pixel Ratio: 3  Screen DPI:  147.131
05-04 21:52:39.106 12702 12826 D Lines   : InterstitialAdWrapper  valid
05-04 21:52:39.185 12702 12826 D Lines   : qml: Registering adfree
05-04 21:52:39.189  7632  9145 W Finsky  : [672] gcs.d(23): net.geographx.LinesGame: No account found.
05-04 21:52:39.411 12702 12826 D Lines   : qml: adfree Component.onCompleted
05-04 21:52:39.413 12702 12826 D Lines   : InterstitialAdWrapper: calling Java method ' initializeInterstitialAd ' from C++
05-04 21:52:39.413 12702 12826 D Lines   : Starting the application event loop...
05-04 21:52:39.463 12702 12826 D Lines   : onApplicationStateChanged(Qt::ApplicationActive)
(more…)

Packaging QT application into Android App Bundle (AAB)

In Qt Creator 4.11.0 on Projects page check “Build .aab”:

This will create .aab file.

(more…)