Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Cannot select API 33 for Android Target SDK in QT Creator
Forum Updated to NodeBB v4.3 + New Features

Cannot select API 33 for Android Target SDK in QT Creator

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
20 Posts 7 Posters 8.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JoeCFDJ JoeCFD

    @nostar I use QtCreator 11.0.1(comes with 5.15.2) which has options in Build->Build Steps->Build Android APK: here you click Details and then you can see Application with selection for Android build platform SDK: choose android-33. You are good to go.

    N Offline
    N Offline
    nostar
    wrote on last edited by
    #3

    @JoeCFD In my original post I stated that I did that. The AndroidManifest.xml file still only allows up to 31 to be selected. Once again, if I try to set it to 33 manual in the xml, then it wipes out the whole tag.

    JoeCFDJ 1 Reply Last reply
    0
    • N nostar

      @JoeCFD In my original post I stated that I did that. The AndroidManifest.xml file still only allows up to 31 to be selected. Once again, if I try to set it to 33 manual in the xml, then it wipes out the whole tag.

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #4

      @nostar Maybe your AndroidManifest.xml path has been changed. Make a copy of your old one. Try to create a new one from QtCreator to see if you can see SDK version. If yes, copy the contents of your old one to the new one.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nostar
        wrote on last edited by
        #5

        The path for all of the android files are in my pro file:

        DISTFILES +=
        android/AndroidManifest.xml
        android/build.gradle
        android/gradle/wrapper/gradle-wrapper.jar
        android/gradle/wrapper/gradle-wrapper.properties
        android/gradlew
        android/gradlew.bat
        android/res/values/libs.xml \

        That being said, I made a test copy of my entire qt project, and deleted all of the android files and created them fresh using the 'Create Templates' button under projects. API 31 reamains the highest version I can choose in the AndroidManifest.xml editor.

        JoeCFDJ 1 Reply Last reply
        0
        • N nostar

          The path for all of the android files are in my pro file:

          DISTFILES +=
          android/AndroidManifest.xml
          android/build.gradle
          android/gradle/wrapper/gradle-wrapper.jar
          android/gradle/wrapper/gradle-wrapper.properties
          android/gradlew
          android/gradlew.bat
          android/res/values/libs.xml \

          That being said, I made a test copy of my entire qt project, and deleted all of the android files and created them fresh using the 'Create Templates' button under projects. API 31 reamains the highest version I can choose in the AndroidManifest.xml editor.

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #6

          @nostar That is weird. Can you select 33 on the GUI? What is your Java version?
          use command
          grep -RHi 31
          to find out which files have 31

          N 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @nostar That is weird. Can you select 33 on the GUI? What is your Java version?
            use command
            grep -RHi 31
            to find out which files have 31

            N Offline
            N Offline
            nostar
            wrote on last edited by
            #7

            @JoeCFD What do you mean exactly by the GUI? I assume you mean the graphical editor for the manifest file, which is my original complaint. The combox for Target SDK lists only 'not set' then a list from API 16 to API 31. Once again, if I edit the XML source directly and change it to 33, then Qt Creator deletes the entire uses-sdk tag from the xml file and the combo box changes to 'not set' and becomes unchangeable (disabled combox)

            The only thing grep returns that is relevent is the manifest file tag and 2 tags from the pro.user file:

            android/AndroidManifest.xml:<uses-sdk android:targetSdkVersion="31"/>
            
            DroidStar.pro.user:    <value type="int" key="AndroidVersion.ApiLevel">31</value>
            DroidStar.pro.user:    <value type="int" key="AndroidVersion.ApiLevel">31</value>
            
            
            N 1 Reply Last reply
            0
            • N nostar

              @JoeCFD What do you mean exactly by the GUI? I assume you mean the graphical editor for the manifest file, which is my original complaint. The combox for Target SDK lists only 'not set' then a list from API 16 to API 31. Once again, if I edit the XML source directly and change it to 33, then Qt Creator deletes the entire uses-sdk tag from the xml file and the combo box changes to 'not set' and becomes unchangeable (disabled combox)

              The only thing grep returns that is relevent is the manifest file tag and 2 tags from the pro.user file:

              android/AndroidManifest.xml:<uses-sdk android:targetSdkVersion="31"/>
              
              DroidStar.pro.user:    <value type="int" key="AndroidVersion.ApiLevel">31</value>
              DroidStar.pro.user:    <value type="int" key="AndroidVersion.ApiLevel">31</value>
              
              
              N Offline
              N Offline
              nostar
              wrote on last edited by
              #8

              I have been using java-11 via openjdk and gradle 5.6 or something until now. I upped to java-17 and then had to modify the gradle file to download grade-7.5 while trying to get API 33 to work.

              JoeCFDJ 1 Reply Last reply
              0
              • N nostar

                I have been using java-11 via openjdk and gradle 5.6 or something until now. I upped to java-17 and then had to modify the gradle file to download grade-7.5 while trying to get API 33 to work.

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by JoeCFD
                #9

                @nostar java 11 is good enough for 33.
                snapshot1.png

                for Java 17, you need gradle 7.3 from here:
                https://docs.gradle.org/current/userguide/compatibility.html

                But I guess Java 17 is for Android 14 from here:
                https://developer.android.com/build/jdks

                Android 	Java 	API and language features supported
                14 (API 34) 	17 	Core libraries
                13 (API 33) 	11 	Core libraries
                12 (API 32) 	11 	Java API
                11 and lower 		Android versions
                
                N 1 Reply Last reply
                0
                • JoeCFDJ JoeCFD

                  @nostar java 11 is good enough for 33.
                  snapshot1.png

                  for Java 17, you need gradle 7.3 from here:
                  https://docs.gradle.org/current/userguide/compatibility.html

                  But I guess Java 17 is for Android 14 from here:
                  https://developer.android.com/build/jdks

                  Android 	Java 	API and language features supported
                  14 (API 34) 	17 	Core libraries
                  13 (API 33) 	11 	Core libraries
                  12 (API 32) 	11 	Java API
                  11 and lower 		Android versions
                  
                  N Offline
                  N Offline
                  nostar
                  wrote on last edited by
                  #10

                  @JoeCFD I meant 7.3, my project wont compile without one and only one correct version of gradle. Meanwhile, the problem remains. I can't build my app with a target SDK of 33.

                  JoeCFDJ 1 Reply Last reply
                  0
                  • N nostar

                    @JoeCFD I meant 7.3, my project wont compile without one and only one correct version of gradle. Meanwhile, the problem remains. I can't build my app with a target SDK of 33.

                    JoeCFDJ Offline
                    JoeCFDJ Offline
                    JoeCFD
                    wrote on last edited by JoeCFD
                    #11

                    @nostar I build my app with Java 11, API 33 and Qt 5.15.2 for Andorid 13 on Ubuntu 22.04 without any issue. My app runs fine.

                    N 1 Reply Last reply
                    0
                    • JoeCFDJ JoeCFD

                      @nostar I build my app with Java 11, API 33 and Qt 5.15.2 for Andorid 13 on Ubuntu 22.04 without any issue. My app runs fine.

                      N Offline
                      N Offline
                      nostar
                      wrote on last edited by
                      #12

                      @JoeCFD I have been struggling with this issue for days and only updated to java 17 right before I posted here. It doesn't seem to matter what version of java I'm using or which SDKs are installed or not installed. The only choices I get in the manifest editor are API 16 through API 31.

                      N JoeCFDJ 2 Replies Last reply
                      0
                      • JoeCFDJ JoeCFD referenced this topic on
                      • N nostar

                        @JoeCFD I have been struggling with this issue for days and only updated to java 17 right before I posted here. It doesn't seem to matter what version of java I'm using or which SDKs are installed or not installed. The only choices I get in the manifest editor are API 16 through API 31.

                        N Offline
                        N Offline
                        nostar
                        wrote on last edited by
                        #13

                        ![alt text](Selection_224.png image url)

                        T 1 Reply Last reply
                        0
                        • N nostar

                          @JoeCFD I have been struggling with this issue for days and only updated to java 17 right before I posted here. It doesn't seem to matter what version of java I'm using or which SDKs are installed or not installed. The only choices I get in the manifest editor are API 16 through API 31.

                          JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by
                          #14

                          @nostar You'd better follow the compatibility settings. Otherwise, it might be tough to find out reasons when things go wrong. Android is such a weird OS.

                          1 Reply Last reply
                          1
                          • N nostar

                            ![alt text](Selection_224.png image url)

                            T Offline
                            T Offline
                            TheCrowKaka
                            wrote on last edited by
                            #15

                            @nostar Hello, did you find a solution for this problem? Even I am facing the exact same problem.

                            A Qt Enthusiastic...

                            L K 2 Replies Last reply
                            0
                            • T TheCrowKaka

                              @nostar Hello, did you find a solution for this problem? Even I am facing the exact same problem.

                              L Offline
                              L Offline
                              lemons
                              wrote on last edited by lemons
                              #16

                              @TheCrowKaka In the following my working configuration. (Qt 5.15)

                              I installed Open JDK 18:
                              JDK-Path: /usr/lib/jvm/java-18-openjdk-amd64

                              Set my target SDK in *.pro:

                              ANDROID_TARGET_SDK_VERSION = 33
                              

                              Updated gradle.properties:

                              org.gradle.jvmargs=-Xmx2048m
                              androidBuildToolsVersion=33.0.2
                              androidCompileSdkVersion=33
                              qtMinSdkVersion=21
                              qtTargetSdkVersion=33
                              android.useAndroidX=true
                              android.enableJetifier=true
                              

                              Updated gradle-wrapper.properties:

                              distributionBase=GRADLE_USER_HOME
                              distributionPath=wrapper/dists
                              #  use newer gradle version, in order to work with JDK 18
                              distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
                              zipStoreBase=GRADLE_USER_HOME
                              zipStorePath=wrapper/dists
                              

                              Updated build.gradle:

                              buildscript {
                                  repositories {
                                      google()
                                      // note: you cant use jcenter() anymore
                                      mavenCentral()
                                      maven { url 'https://jitpack.io' }
                                  }
                              
                                  dependencies {
                                      classpath 'com.android.tools.build:gradle:7.2.1'
                                  }
                              }
                              
                              repositories {
                                  google()
                                  mavenCentral()
                                  maven { url 'https://jitpack.io' }
                              }
                              
                              apply plugin: 'com.android.application'
                              
                              
                              // you won't need all of my dependencies, I require them for my JNI parts
                              // note: if you have some legacy android stuff, you have to fix the imports to use androidx
                              // e.g.
                              // OLD IMPORTS
                              // import android.support.v4.content.FileProvider;
                              // import android.support.v4.app.ShareCompat;
                              // NEW IMPORTS
                              // import androidx.core.content.FileProvider;
                              // import androidx.core.app.ShareCompat;
                              
                              
                              dependencies {
                                  // note the new keywords here, as some got deprecated
                                  // e.g. old depency: 
                                  // compile "com.android.support:support-v4:24.+"
                                  implementation 'androidx.core:core:1.3.2'
                                  implementation 'androidx.legacy:legacy-support-v4:1.0.0' 
                                  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32"
                                  implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
                                  implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
                              }
                              

                              If you can't select "android-33" in the build config view, you can try to manually add the options to your *.pro.user file, and then restart QtCreator:

                              ProjectExplorer.BuildStepList.Step.3:

                               <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.3">
                                    <value type="QString" key="BuildTargetSdk">android-33</value>
                              

                              ProjectExplorer.Target.PluginSettings:

                              <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings">
                                    <value type="int" key="AndroidVersion.ApiLevel">33</value>
                              

                              Note: If you can select a different Android Version (e.g. 26), you might be able to simply search for "26".
                              (in my case I have 4 occurrences for '33'; 3 x within 'ProjectExplorer.BuildStepList.Step.3' and 1 x within 'ProjectExplorer.Target.PluginSettings')

                              1 Reply Last reply
                              0
                              • JoeCFDJ JoeCFD referenced this topic on
                              • T TheCrowKaka

                                @nostar Hello, did you find a solution for this problem? Even I am facing the exact same problem.

                                K Offline
                                K Offline
                                klausix
                                wrote on last edited by
                                #17

                                @TheCrowKaka Having the same problem here.
                                And absolutely no solution in sight. I am using Qt 6.6 on MacOs 14.1.1 with JDK-17.
                                Will try OpenJdk 18, but only after I have cooled down a bit :-P

                                What I ask myself - when editing AndroidManifest.xml in QtCreator: where does it get the list of possible API-Levels from? Couldn't this be a point where to find a solution...?

                                KenAppleby 0K 1 Reply Last reply
                                0
                                • K klausix

                                  @TheCrowKaka Having the same problem here.
                                  And absolutely no solution in sight. I am using Qt 6.6 on MacOs 14.1.1 with JDK-17.
                                  Will try OpenJdk 18, but only after I have cooled down a bit :-P

                                  What I ask myself - when editing AndroidManifest.xml in QtCreator: where does it get the list of possible API-Levels from? Couldn't this be a point where to find a solution...?

                                  KenAppleby 0K Offline
                                  KenAppleby 0K Offline
                                  KenAppleby 0
                                  wrote on last edited by
                                  #18

                                  @klausix I feel your pain.

                                  I am using Qt 6.6.1 on Windows 10 and managed to find a solution to this. I am successfully building my app for platform API-33 using API-33 tools. It's luck not competence that has got me there, but this, in short, is what I did.

                                  • uninstalled Android Studio

                                  • uninstalled the Android SDK

                                  • installed Qt 6.6.1 - probably irrelevant, I was using 6.6.0

                                  • removed the JDK 11 installation I was using

                                  • used the QtCreator Edit => Preferences => Devices => Android => JDK Location "globe" button to install JDK 17 from the default location it offers https://adoptium.net and set the JDK location

                                  • used SDK Manager on the same dialog to install as follows:
                                    qt-android-sdk-manager.jpg

                                  • key step: edit the gradle.properties file in MyApp/android directory to contain:

                                  androidBuildToolsVersion=33.0.0
                                  androidCompileSdkVersion=33
                                  androidNdkVersion=25.1.8937393
                                  buildDir=build
                                  qt5AndroidDir=E:/Qt/6.6.1/android_arm64_v8a/./src/android/java
                                  qtAndroidDir=E:/Qt/6.6.1/android_arm64_v8a/./src/android/java
                                  qtMinSdkVersion=23
                                  qtTargetAbiList=arm64-v8a
                                  qtTargetSdkVersion=33
                                  android.suppressUnsupportedCompileSdk=33
                                  

                                  [In my project this file was created some time ago via the "Create Templates" option when I was using Qt 6.5.3 . It originally contained no equivalent of the quoted section.]

                                  • remove the app build directories
                                  • remove the project CMakeLists.txt.user file
                                  • restart QtCreator and load the application CMake project
                                  • in Projects => Android Qt 6.6.1 Clang arm-64-v8a => Build => Build Android APK => Application set Android build platform SDK to android-33 (android-31 was also offered.) The Android build-tools version was stuck on 31

                                  The app then built in a Debug buld without problems and ran okay on a Pixel 7 running Android 14.
                                  I then connected a Pixel 4a running Android 13 to another USB port. Qt Creator crashed after about 30 seconds of spinning. When I restarted it the option to use build-tools 33 was available. Now both Release and Debug builds are fine.

                                  KenAppleby 0K 1 Reply Last reply
                                  0
                                  • KenAppleby 0K KenAppleby 0

                                    @klausix I feel your pain.

                                    I am using Qt 6.6.1 on Windows 10 and managed to find a solution to this. I am successfully building my app for platform API-33 using API-33 tools. It's luck not competence that has got me there, but this, in short, is what I did.

                                    • uninstalled Android Studio

                                    • uninstalled the Android SDK

                                    • installed Qt 6.6.1 - probably irrelevant, I was using 6.6.0

                                    • removed the JDK 11 installation I was using

                                    • used the QtCreator Edit => Preferences => Devices => Android => JDK Location "globe" button to install JDK 17 from the default location it offers https://adoptium.net and set the JDK location

                                    • used SDK Manager on the same dialog to install as follows:
                                      qt-android-sdk-manager.jpg

                                    • key step: edit the gradle.properties file in MyApp/android directory to contain:

                                    androidBuildToolsVersion=33.0.0
                                    androidCompileSdkVersion=33
                                    androidNdkVersion=25.1.8937393
                                    buildDir=build
                                    qt5AndroidDir=E:/Qt/6.6.1/android_arm64_v8a/./src/android/java
                                    qtAndroidDir=E:/Qt/6.6.1/android_arm64_v8a/./src/android/java
                                    qtMinSdkVersion=23
                                    qtTargetAbiList=arm64-v8a
                                    qtTargetSdkVersion=33
                                    android.suppressUnsupportedCompileSdk=33
                                    

                                    [In my project this file was created some time ago via the "Create Templates" option when I was using Qt 6.5.3 . It originally contained no equivalent of the quoted section.]

                                    • remove the app build directories
                                    • remove the project CMakeLists.txt.user file
                                    • restart QtCreator and load the application CMake project
                                    • in Projects => Android Qt 6.6.1 Clang arm-64-v8a => Build => Build Android APK => Application set Android build platform SDK to android-33 (android-31 was also offered.) The Android build-tools version was stuck on 31

                                    The app then built in a Debug buld without problems and ran okay on a Pixel 7 running Android 14.
                                    I then connected a Pixel 4a running Android 13 to another USB port. Qt Creator crashed after about 30 seconds of spinning. When I restarted it the option to use build-tools 33 was available. Now both Release and Debug builds are fine.

                                    KenAppleby 0K Offline
                                    KenAppleby 0K Offline
                                    KenAppleby 0
                                    wrote on last edited by
                                    #19

                                    The gradle.properties file contains

                                    android.suppressUnsupportedCompileSdk=33
                                    

                                    as recommended by the warning that is issued by the build if you leave this out. The warning is that gradle plugin 7.2.1 has not been tested against android API-33.

                                    This seems to be in contradiction to the information here:

                                    https://developer.android.com/build/releases/gradle-plugin#groovy

                                    which appears to say that Android Gradle Plugin (AGP) version 7.2 is valid for API-33

                                    Also, as mentioned in this post:
                                    https://forum.qt.io/topic/151244/online-installed-android-qt-6-6-but-build-requires-newer-version
                                    by @shokarta Qt insists on installing the android SDK for API 31, whether you want it or not.

                                    I suspect both of these are bugs which can be ignored. But they do compound the general confusion.

                                    Cavit VURALC 1 Reply Last reply
                                    0
                                    • KenAppleby 0K KenAppleby 0

                                      The gradle.properties file contains

                                      android.suppressUnsupportedCompileSdk=33
                                      

                                      as recommended by the warning that is issued by the build if you leave this out. The warning is that gradle plugin 7.2.1 has not been tested against android API-33.

                                      This seems to be in contradiction to the information here:

                                      https://developer.android.com/build/releases/gradle-plugin#groovy

                                      which appears to say that Android Gradle Plugin (AGP) version 7.2 is valid for API-33

                                      Also, as mentioned in this post:
                                      https://forum.qt.io/topic/151244/online-installed-android-qt-6-6-but-build-requires-newer-version
                                      by @shokarta Qt insists on installing the android SDK for API 31, whether you want it or not.

                                      I suspect both of these are bugs which can be ignored. But they do compound the general confusion.

                                      Cavit VURALC Offline
                                      Cavit VURALC Offline
                                      Cavit VURAL
                                      wrote on last edited by
                                      #20

                                      @KenAppleby-0

                                      Here is the solution :

                                      build.gradle in android directory

                                      1 - Version must be 7.4.2 or newer

                                      dependencies {
                                           classpath 'com.android.tools.build:gradle:7.4.2'
                                      }
                                      

                                      2 - Set targetSdkVersion manually

                                      defaultConfig {
                                          resConfig "en"
                                          minSdkVersion qtMinSdkVersion
                                          targetSdkVersion 33
                                          ndk.abiFilters = qtTargetAbiList.split(",")
                                      }
                                      

                                      gradle-wrapper.properties in android/gradle/wrapper directory

                                      distributionBase=GRADLE_USER_HOME
                                      distributionPath=wrapper/dists
                                      distributionUrl=https://services.gradle.org/distributions/gradle-8.0-bin.zip
                                      zipStoreBase=GRADLE_USER_HOME
                                      zipStorePath=wrapper/dists

                                      1 Reply Last reply
                                      1
                                      • C CellCS referenced this topic on

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved