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.5k 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.
  • N nostar
    3 Oct 2023, 00:44

    @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.

    J Offline
    J Offline
    JoeCFD
    wrote on 3 Oct 2023, 13:45 last edited by JoeCFD 10 Mar 2023, 13:52
    #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 3 Oct 2023, 14:13
    0
    • J JoeCFD
      3 Oct 2023, 13:45

      @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 3 Oct 2023, 14:13 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 J 2 Replies Last reply 3 Oct 2023, 14:23
      0
      • J JoeCFD referenced this topic on 3 Oct 2023, 14:18
      • N nostar
        3 Oct 2023, 14:13

        @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 3 Oct 2023, 14:23 last edited by
        #13

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

        T 1 Reply Last reply 10 Oct 2023, 11:17
        0
        • N nostar
          3 Oct 2023, 14:13

          @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.

          J Offline
          J Offline
          JoeCFD
          wrote on 3 Oct 2023, 14:59 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
            3 Oct 2023, 14:23

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

            T Offline
            T Offline
            TheCrowKaka
            wrote on 10 Oct 2023, 11:17 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 12 Oct 2023, 10:00
            0
            • T TheCrowKaka
              10 Oct 2023, 11:17

              @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 12 Oct 2023, 10:00 last edited by lemons 10 Dec 2023, 10:58
              #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
              • J JoeCFD referenced this topic on 19 Oct 2023, 14:33
              • T TheCrowKaka
                10 Oct 2023, 11:17

                @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 12 Dec 2023, 20:37 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 13 Dec 2023, 20:41
                0
                • K klausix
                  12 Dec 2023, 20:37

                  @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 13 Dec 2023, 20:41 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 13 Dec 2023, 21:13
                  0
                  • KenAppleby 0K KenAppleby 0
                    13 Dec 2023, 20:41

                    @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 13 Dec 2023, 21:13 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 24 Dec 2023, 06:05
                    0
                    • KenAppleby 0K KenAppleby 0
                      13 Dec 2023, 21:13

                      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 24 Dec 2023, 06:05 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 15 Jan 2024, 15:44

                      • Login

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