Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-32932

Automatic selection of too low Android SDK version

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt Creator 15.0.1, Qt Creator 16.0.0
    • Android Support
    • None
    • Ubuntu 22.04, Qt 6.10.0 (dev).
      Windows 11 (version 10), QT 6.8.1
    • Android
    • 2025wk22s1-2QtforAndroid

    Description

      I have installed SDKs 23, 26-31, 33-35 with Qt Creator's SDK Manager. 

      I have built Qt for Android locally, and this kit is automatically found by Qt Creator as "Android Qt 6.10.0 (qt6-build-android-install) Clang x86_64". 

      During the Qt build, API level 28 is used by default:  

      – Android toolchain file within NDK detected: /home/jannejuntunen/Android/Sdk/ndk/27.2.12479018/build/cmake/android.toolchain.cmake
      – Android build detected, checking configuration defaults...
      – Neither ANDROID_PLATFORM nor ANDROID_NATIVE_API_LEVEL were specified, using API level 28 as default 
      

      When I created an application in Qt Creator which required access to the API level 28 NDK, I got this error (see attached reproducer). 

      /home/jannejuntunen/temp/wrongSdkSelected/main.cpp:19:40: error: 'AMEDIAFORMAT_KEY_PRIORITY' is unavailable: introduced in Android 28
         19 |     AMediaFormat_setInt32(mediaFormat, AMEDIAFORMAT_KEY_PRIORITY, 0);

      Problem: it seems that Qt Creator defaults to SDK 23 when building the application.

      When I build the reproducer from the command line, I do not see this error.

      Creator maybe fails to read the SDK version from the kit in here:
      https://github.com/qt-creator/qt-creator/blob/0bd06dc46f0d0d9b518c97e00cbe666a86dab7ef/src/plugins/android/androidutils.cpp#L182

      and then defaults to 23:
      https://github.com/qt-creator/qt-creator/blob/0bd06dc46f0d0d9b518c97e00cbe666a86dab7ef/src/plugins/android/androidutils.cpp#L477

      Attachments

        1. wrongSdkSelected.tar.gz
          1 kB
          Janne Juntunen
        2. image-2025-05-15-14-00-22-089.png
          31 kB
          Janne Juntunen
        3. image-2025-05-15-14-00-54-772.png
          39 kB
          Janne Juntunen
        4. image-2025-05-15-14-02-39-157.png
          83 kB
          Janne Juntunen
        5. image-2025-05-15-14-07-46-531.png
          26 kB
          Janne Juntunen
        6. image-2025-05-15-14-15-31-796.png
          83 kB
          Janne Juntunen

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              sheree_anne Sheree Morphett
              jannej Janne Juntunen
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes