User:Joger

From Qt Wiki
Revision as of 18:28, 11 February 2024 by Joger (talk | contribs) (Added my setup for Android development)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

My build setup

OS: Windows 11 with dev drive mounted on D:

Qt source tree: <code>D:\qt\qt6\</code>

Build directory containing all builds: <code>D:\qt\build\</code>

Host build for dev branch: <code>D:\qt\build\dev\</code>

Setting up Qt Creator for Android

  1. Install Qt Creator with Android option
  2. In Creator preferences, install Adoptium JDK (<code>C:\Program Files\Eclipse Adoptium\jdk-17.0.10.7-hotspot)</code>
  3. Android SDK location: <code>C:\dev\android</code>
  4. Select Android NDK 26.1.10909125 and make default
  5. Oppenssl location: <code>C:\dev\android\android_openssl</code>
  6. Verify Android settings: Android settings 26.png
  7. Add Android device for ABI x86_64, OS Version 13.0 ("Tiramisu") (SDK 33)
  8. Android Emulator.png

Building Qt for Android on Windows

Main build root Android: <code>D:\qt\build\android</code>

Configure Qt for Android in build root using host build

<code>cmake -DQT_BUILD_SUBMODULES=QtMultimedia -DQT_HOST_PATH=D:/qt/build/dev/qtbase -DQT_BUILD_TESTS_BY_DEFAULT=OFF -DQT_BUILD_TESTS=ON -DANDROID_PLATFORM=android-33 -DQT_USE_TARGET_ANDROID_BUILD_DIR=TRUE -DQT_QMAKE_TARGET_MKSPEC=android-clang -DANDROID_SDK_ROOT=C:/dev/android -DANDROID_NDK_ROOT=C:/dev/android/ndk/26.1.10909125 -DANDROID_ABI=x86_64 -DQT_BUILD_EXAMPLES=FALSE -DCMAKE_BUILD_TYPE=Debug -DINPUT_developer_build=yes --fresh -G Ninja D:/qt/qt6 & ninja</code>

Main build directory for Qt Multimedia on Android: <code>D:\qt\build\androidmultimedia</code> Configure Qt Multimedia for Android

<code>cmake-DCMAKE_TOOLCHAIN_FILE=D:\qt\build\android\qtbase\lib\cmake\qt6\qt.toolchain.cmake -G Ninja  -DQT_USE_ORIGINAL_COMPILER=ON -DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF D:/qt/qt6/qtmultimedia & ninja</code>

Importing Qt Multimedia build into QtCreator

  1. Open QtMultimedia CMakeLists.txt from <code>D:\qt\qt6\qtmultimedia</code>
  2. Deselect all kits
  3. Import build from <code>D:\qt\build\androidmultimedia</code>
    • This creates a Android Qt 6.8.0 (android) Clang x86_64 kit
    • Configure is run automatically again
  4. Select a test to be built (tst_qmediadevices) and choose a corresponding emulator in project build settings for Android kit
  5. Build target tst_qmediadevices
  6. Observe error message:

<code>19:15:12: The process "C:\Program Files\CMake\bin\cmake.exe" exited normally.</code>

<code>19:15:12: Starting: "D:\qt\build\dev\qtbase\bin\androiddeployqt.exe" --input D:/qt/build/androidmultimedia/tests/auto/unit/multimedia/qmediadevices/android-tst_qmediadevices-deployment-settings.json --output D:/qt/build/androidmultimedia/tests/auto/unit/multimedia/qmediadevices/android-build --android-platform android-33 --jdk "C:/Program Files/Eclipse Adoptium/jdk-17.0.10.7-hotspot" --gradle</code>

<code>Cannot find application binary in build dir D:/qt/build/androidmultimedia/tests/auto/unit/multimedia/qmediadevices/android-build//libs/x86_64/libtst_qmediadevices_x86_64.so.</code>

<code>19:15:12: The process "D:\qt\build\dev\qtbase\bin\androiddeployqt.exe" exited with code 2.</code>

<code>Error while building/deploying project QtMultimedia (kit: Android Qt 6.8.0 (android) Clang x86_64)</code>

<code>When executing step "Build Android APK"</code>

<code>19:15:12: Elapsed time: 01:05.</code>