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

Automatic selection of too low Android SDK version

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • Qt Creator 17.0.1
    • 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
    • bea33f47b (master), 8d07e721e (dev), 168524ed5 (6.10), 17868a8e7 (6.9), 5fde2953f (tqtc/lts-6.8)
    • 2025wk22s1-2QtforAndroid, 2025wk24s2QtforAndroid, 2025wk26s2QtforAndroid, 2025wk28s2QtforAndroid

      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

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes