Category Archives: Platforms and frameworks

“Null object reference” exceptions on Android 14 in a QT app

When I switched to QT 6.7.2 and set QT_ANDROID_TARGET_SDK_VERSION "34" (that is Android 14) my QT app started to crash with the following stack traces:

On google Pixel 5 64-bit only 1080x2340 Android 14 (SDK 34) arm64-v8a:

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
  at android.os.Parcel.createExceptionOrNull (Parcel.java:3189)
  at android.os.Parcel.createException (Parcel.java:3167)
  at android.os.Parcel.readException (Parcel.java:3150)
  at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:202)
  at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:154)
  at android.content.ContentProviderProxy.call (ContentProviderNative.java:764)
  at android.content.ContentResolver.call (ContentResolver.java:2466)
  at android.content.ContentResolver.call (ContentResolver.java:2446)
  at ekfr.a (:com.google.android.gms@242013038@24.20.13 (190400-633713831):29)
  at com.google.android.gms.wallet.intentoperation.setupwizard.PaymentsSetupWizardAccountChangeIntentOperation.onHandleIntent (:com.google.android.gms@242013038@24.20.13 (190400-633713831):252)
  at com.google.android.chimera.IntentOperation.onHandleIntent (:com.google.android.gms@242013038@24.20.13 (190400-633713831):2)
  at ajdw.onHandleIntent (:com.google.android.gms@242013038@24.20.13 (190400-633713831):8)
  at pbh.run (:com.google.android.gms@242013038@24.20.13 (190400-633713831):70)
  at pbg.run (:com.google.android.gms@242013038@24.20.13 (190400-633713831):152)
  at elbx.run (:com.google.android.gms@242013038@24.20.13 (190400-633713831):21)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
  at java.lang.Thread.run (Thread.java:1012)
(more…)

QT stopped compiling with QT_NO_EXCEPTIONS

QT 6.7.2 failed to build with QT_NO_EXCEPTIONS for Android with the following errors:

C:/dev/repos/qt-everywhere-src-6.7.2/qtbase/src/corelib/io/qprocess_unix.cpp:889:29: error: use of undeclared identifier 'e'
        failChildProcess(d, e.what(), FakeErrnoForThrow);
                            ^
C:/dev/repos/qt-everywhere-src-6.7.2/qtbase/src/corelib/io/qprocess_unix.cpp:890:7: error: expected expression
    } QT_CATCH (...) {
      ^
C:/dev/repos/qt-everywhere-src-6.7.2/qtbase/src/corelib/global/qexceptionhandling.h:28:23: note: expanded from macro 'QT_CATCH'
#  define QT_CATCH(A) else
                      ^
2 errors generated.
[673/5992] Building CXX object qtbase/src/corelib/CMakeFiles/Core.dir/itemmodels/qabstractitemmodel.cpp.o
ninja: build stopped: subcommand failed.
(more…)

Building Lines Game for MacOS and iOS

To build my app for iOS I tried to run CMake from the command line without QT Creator:

cmake -S /Users/admin/dev/repos/examples/src/LinesGame/LinesGameQt -B . -DCMAKE_GENERATOR:STRING=Xcode \
  -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=./.qtc/package-manager/auto-setup.cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/Users/admin/dev/libs/QT6/release/iOS/bin/qmake6 \
  -DCMAKE_PREFIX_PATH:PATH=/Users/admin/dev/libs/QT6/release/iOS \
  -DCMAKE_C_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang \
  -DCMAKE_CXX_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ \
  -DCMAKE_TOOLCHAIN_FILE:FILEPATH=/Users/admin/dev/libs/QT6/release/iOS/lib/cmake/Qt6/qt.toolchain.cmake \
  -DCMAKE_OSX_ARCHITECTURES:STRING=arm64 -DCMAKE_OSX_SYSROOT:STRING=iphoneos -DCMAKE_CXX_FLAGS_INIT:STRING= \
  -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM:STRING=XXXXXXX
(more…)

Publishing MacOS QT app in Apple App Store

First I set CMake generator to XCode in QT Creator Kits settings page:

(more…)

Publishing iOS QT app in Apple App Store

I downloaded provisioning profiles with XCode:

(more…)

Building QT6.7 on MacOS Sonoma

I installed MacOS Sonoma on HyperV, installed XCode and used the following commands to check compiler and SDK versions:

admin@son ~ % xcode-select -print-path
/Applications/Xcode.app/Contents/Developer
admin@son ~ %  xcrun -sdk macosx -find clang
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
admin@son ~ % clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
admin@son ~ % xcrun -sdk macosx --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk
(more…)

Configuring QT Creator with QT 6.6.2

I built QT 6.6.2, installed QT Creator and updated "%SystemDrive%\Documents and Settings\%USERNAME%\Application Data\QtProject\qtcreator\android\sdk_definitions.json" file as follows:

...

"specific_qt_versions": [
    {
        "versions": ["default"],
        "sdk_essential_packages": ["build-tools;34.0.0", "ndk;26.2.11394342"]
    },
    {
        "versions": ["6.4"],
        "sdk_essential_packages": ["build-tools;31.0.0", "ndk;23.1.7779620"]
    },
    {
        "versions": ["6.3", "6.2", "5.15.[9-20]"],
        "sdk_essential_packages": ["build-tools;31.0.0", "ndk;22.1.7171670"]
    },
    {
        "versions": ["5.15.[0-8]", "5.14.[0-2]", "5.13.2", "6.0", "6.1"],
        "sdk_essential_packages": ["build-tools;31.0.0", "ndk;21.3.6528147"]
    },
    {
        "versions": ["5.12.[0-5]", "5.13.[0-1]"],
        "sdk_essential_packages": ["build-tools;28.0.2", "ndk;19.2.5345600"]
    }
]

...

(more…)

Building QT 6.6.2 for Windows and Android

I installed MS Visual Studio, Android Studio and the following tools:

cmake-3.24.2-windows-x86_64
nasm-2.15.05
ninja-win
Python35
Strawberry
VulkanSDK
x86_64-12.2.0-release-win32-seh-rt_v10-rev0

and built QT for Windows with the following commands:

(more…)

Unification of Win32 and UWP

Looks like QT6 does not support UWP:

During this year’s Microsoft Build conference Microsoft announced the
unification of Win32 and UWP for their IoT offering. In general, it
looks like Microsoft is stepping away from their strict stance about the
usage of UWP technology and the Windows Store. Getting a classic Windows
application into the Windows Store is much easier nowadays and will be
even simpler in the future. Microsoft’s new direction in their IoT
offering will bring more “classic Windows development” into the IoT
world and there will be no need for a dedicated UWP port.

Compiling a single C++ source file in QT Creator

My QT Creator builds an Android app with the following command:

"D:\dev\tools\cmake-3.24.2-windows-x86_64\bin\cmake.exe" --build D:/dev/repos/tradeclient/src/build-TradeClient-Android_Qt_6_5_2_arm64_v8a_debug_Clang_arm64_v8a-Debug --target all

I simply started Windows Command Prompt and was able to run the following commands:

set PATH=%PATH%;C:\Qt\qtcreator-10.0.2\bin\jom
cd D:\dev\repos\tradeclient\src\build-TradeClient-Android_Qt_6_5_2_arm64_v8a_debug_Clang_arm64_v8a-Debug
"D:\dev\tools\cmake-3.24.2-windows-x86_64\bin\cmake.exe" --build . --target BotFactory.cpp.o
"D:\dev\tools\cmake-3.24.2-windows-x86_64\bin\cmake.exe" --build . --target ExchangeModel.cpp.o > my.txt 2>&1
"D:\dev\tools\cmake-3.24.2-windows-x86_64\bin\cmake.exe" --build . --target Bots/ShortBot.cpp.o > my2.txt 2>&1