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. Android app doesn't run
Forum Updated to NodeBB v4.3 + New Features

Android app doesn't run

Scheduled Pinned Locked Moved Solved Mobile and Embedded
87 Posts 7 Posters 23.5k Views 3 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.
  • mzimmersM mzimmers

    @ekkescorner

    • Qt 6.5.3
    • Qt Creator 14.0.1
    • SDK Version: 12.0
    • NDK Version: 25.1.8937393
    • JDK 17
    • Using CMake
    • Windows 11

    Not sure what you mean by Java API, but maybe this will help:

    C:\Users\michael.zimmers>java --version
    java 17.0.9 2023-10-17 LTS
    Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201)
    Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)
    
    C:\Users\michael.zimmers>
    

    Thanks for any assistance.

    ekkescornerE Offline
    ekkescornerE Offline
    ekkescorner
    Qt Champions 2016
    wrote on last edited by
    #73

    @mzimmers said in Android app doesn't run:

    Not sure what you mean by Java API

    I meant

    set_target_properties(${MY_APP}
        PROPERTIES
            QT_ANDROID_MIN_SDK_VERSION 26
            QT_ANDROID_TARGET_SDK_VERSION 34
    )
    

    my settings from 6.7.1
    for 6.5 seems to be 23, 33 (see https://www.qt.io/blog/qt-for-android-supported-versions-guidelines)

    Thanks for any assistance.
    ATM have no idea

    have you created (updated) Android Templates so all fits together ?

    ekke ... Qt Champion 2016 | 2024 ... mobile business apps
    5.15 --> 6.9 https://t1p.de/ekkeChecklist
    QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

    mzimmersM 1 Reply Last reply
    0
    • ekkescornerE ekkescorner

      @mzimmers said in Android app doesn't run:

      Not sure what you mean by Java API

      I meant

      set_target_properties(${MY_APP}
          PROPERTIES
              QT_ANDROID_MIN_SDK_VERSION 26
              QT_ANDROID_TARGET_SDK_VERSION 34
      )
      

      my settings from 6.7.1
      for 6.5 seems to be 23, 33 (see https://www.qt.io/blog/qt-for-android-supported-versions-guidelines)

      Thanks for any assistance.
      ATM have no idea

      have you created (updated) Android Templates so all fits together ?

      mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #74

      @ekkescorner I've created the templates, but I haven't modified them. I can't find documentation that tells me how to populate the fields.
      Screenshot 2024-08-18 082850.png
      Note that the pulldowns for setting the SDK are disabled.

      ekkescornerE JKSHJ 2 Replies Last reply
      0
      • mzimmersM mzimmers

        @ekkescorner I've created the templates, but I haven't modified them. I can't find documentation that tells me how to populate the fields.
        Screenshot 2024-08-18 082850.png
        Note that the pulldowns for setting the SDK are disabled.

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote on last edited by
        #75

        @mzimmers said in Android app doesn't run:

        Note that the pulldowns for setting the SDK are disabled.

        Google has changed this long time ago. Now Min and Target are managed by Gradle and not the Manifest.

        here's some info from my blogs HowTo do this with CMake:
        https://ekkesapps.wordpress.com/qt-6-in-action/qmake-cmake/android-specific/

        ekke ... Qt Champion 2016 | 2024 ... mobile business apps
        5.15 --> 6.9 https://t1p.de/ekkeChecklist
        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

        1 Reply Last reply
        0
        • mzimmersM mzimmers

          @ekkescorner I've created the templates, but I haven't modified them. I can't find documentation that tells me how to populate the fields.
          Screenshot 2024-08-18 082850.png
          Note that the pulldowns for setting the SDK are disabled.

          JKSHJ Online
          JKSHJ Online
          JKSH
          Moderators
          wrote on last edited by
          #76

          @mzimmers said in Android app doesn't run:

          @ekkescorner I've created the templates, but I haven't modified them. I can't find documentation that tells me how to populate the fields.
          Screenshot 2024-08-18 082850.png
          Note that the pulldowns for setting the SDK are disabled.

          That editor is badly broken. I recommend avoiding it: https://bugreports.qt.io/browse/QTCREATORBUG-27119

          As a quick sanity check, create a new "Hello World" project. Does that build and run correctly?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #77

            @JKSH OK, built a new project. I configured it for Android, but there's nothing in the CMakeLists.txt file about Android. (I didn't add any of the stuff that @ekkescorner mentions on his web page.) When I build, I get an error:

            :-1: error:      aapt2.exe E 08-18 19:22:13 16988 23404 ApkAssets.cpp:149] Failed to load resources table in APK 'C:\Users\michael.zimmers\AppData\Local\Android\Sdk\platforms\android-35\android.jar'.
                 error: failed to load include path C:\Users\michael.zimmers\AppData\Local\Android\Sdk\platforms\android-35\android.jar.
            
            * Try:
            > Run with --stacktrace option to get the stack trace.
            > Run with --info or --debug option to get more log output.
            > Run with --scan to get full insights.
            
            * Get more help at https://help.gradle.org
            

            So, I'm not sure where to go from here. It's hard to tell whether the problem is in my Android setup, or my specific project settings.

            ekkescornerE 1 Reply Last reply
            0
            • mzimmersM mzimmers

              @JKSH OK, built a new project. I configured it for Android, but there's nothing in the CMakeLists.txt file about Android. (I didn't add any of the stuff that @ekkescorner mentions on his web page.) When I build, I get an error:

              :-1: error:      aapt2.exe E 08-18 19:22:13 16988 23404 ApkAssets.cpp:149] Failed to load resources table in APK 'C:\Users\michael.zimmers\AppData\Local\Android\Sdk\platforms\android-35\android.jar'.
                   error: failed to load include path C:\Users\michael.zimmers\AppData\Local\Android\Sdk\platforms\android-35\android.jar.
              
              * Try:
              > Run with --stacktrace option to get the stack trace.
              > Run with --info or --debug option to get more log output.
              > Run with --scan to get full insights.
              
              * Get more help at https://help.gradle.org
              

              So, I'm not sure where to go from here. It's hard to tell whether the problem is in my Android setup, or my specific project settings.

              ekkescornerE Offline
              ekkescornerE Offline
              ekkescorner
              Qt Champions 2016
              wrote on last edited by
              #78

              @mzimmers running Qt Examples without changes this should work without creating and modifying templates.
              If examples don't run there seems to be something wrong with your Android / QtC installation
              BTW: you can verify the settings for min and target. go to your build dir and take a look at

              build
                  android-build
                        gradle.properties
              

              ekke ... Qt Champion 2016 | 2024 ... mobile business apps
              5.15 --> 6.9 https://t1p.de/ekkeChecklist
              QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

              1 Reply Last reply
              0
              • mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by mzimmers
                #79

                @ekkescorner just to be clear, this error didn't come from one of the presupplied Qt examples. I created it using the project wizard.

                Here are the version settings in my gradle.properties file:

                androidBuildToolsVersion=33.0.0
                androidCompileSdkVersion=android-35
                androidNdkVersion=25.1.8937393
                qtMinSdkVersion=23
                qtTargetAbiList=arm64-v8a
                qtTargetSdkVersion=31
                

                They don't seem to match what you indicated would be correct.

                BTW: Is there a typo in this section of your page?

                Qt supports these API Level:
                
                Qt 6.6: Min API 26 (Android 8)
                Qt 6.8 MIn API 28 (Android 9)
                see QTBUG-124890
                Qt 6.6: Target API 33 (Android 13)
                Qt 6.7: Target API 34 (Android 14)
                
                1 Reply Last reply
                0
                • ekkescornerE Offline
                  ekkescornerE Offline
                  ekkescorner
                  Qt Champions 2016
                  wrote on last edited by
                  #80

                  this is from one of my 6.7.1 apps:

                  android.useAndroidX=true
                  androidBuildToolsVersion=34.0.0
                  androidCompileSdkVersion=android-34
                  androidNdkVersion=26.1.10909125
                  qtMinSdkVersion=26
                  qtTargetAbiList=arm64-v8a
                  qtTargetSdkVersion=34
                  

                  QMake or CMake - always the same for my projects

                  BTW: some examples from create (update) Templates I did:
                  https://ekkesapps.wordpress.com/qt-6-cmake/qtcreator-android-templates-2/

                  ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                  5.15 --> 6.9 https://t1p.de/ekkeChecklist
                  QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                  1 Reply Last reply
                  0
                  • mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #81

                    OK, but...given that this file is built for me, clearly I don't want to just make changes to it. Where are the settings that populate the contents of this file when it's built? Is there something wrong with my Preferences -> Devices -> Android settings?

                    1 Reply Last reply
                    0
                    • ekkescornerE Offline
                      ekkescornerE Offline
                      ekkescorner
                      Qt Champions 2016
                      wrote on last edited by
                      #82

                      don't know what's wrong
                      seems you have built with android-35
                      dont know if this works with 6.5
                      have no experiences with 6.5 - started my Qt 6 development with 6.6
                      you can try to change this to 33, what's supported by 6.5

                      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                      5.15 --> 6.9 https://t1p.de/ekkeChecklist
                      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                      1 Reply Last reply
                      1
                      • mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by
                        #83

                        @ekkescorner I changed to 33; no success. I then deleted all my Qt project cache and rebuilt. It now works...sort of. I'm going to have a bunch more questions, but it's time to close out this thread and start a new one. Thank you for all the help.

                        ekkescornerE 1 Reply Last reply
                        0
                        • mzimmersM mzimmers has marked this topic as solved on
                        • mzimmersM mzimmers

                          @ekkescorner I changed to 33; no success. I then deleted all my Qt project cache and rebuilt. It now works...sort of. I'm going to have a bunch more questions, but it's time to close out this thread and start a new one. Thank you for all the help.

                          ekkescornerE Offline
                          ekkescornerE Offline
                          ekkescorner
                          Qt Champions 2016
                          wrote on last edited by
                          #84

                          @mzimmers said in Android app doesn't run:

                          I then deleted all my Qt project cache and rebuilt. It now works

                          this is always the first thing if something wrong with build or if templates created or QtC changed: delete the build dir physically - not only build-clean in QtC
                          sorry - forgot to ask you about ;-)
                          good that it's working

                          ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                          5.15 --> 6.9 https://t1p.de/ekkeChecklist
                          QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                          mzimmersM 1 Reply Last reply
                          0
                          • ekkescornerE ekkescorner

                            @mzimmers said in Android app doesn't run:

                            I then deleted all my Qt project cache and rebuilt. It now works

                            this is always the first thing if something wrong with build or if templates created or QtC changed: delete the build dir physically - not only build-clean in QtC
                            sorry - forgot to ask you about ;-)
                            good that it's working

                            mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #85

                            @ekkescorner just to be clear, for me it was not sufficient to delete the build directory. I had to go into home\AppData\Roaming\QtProject and delete all the files in there.

                            1 Reply Last reply
                            0
                            • ekkescornerE Offline
                              ekkescornerE Offline
                              ekkescorner
                              Qt Champions 2016
                              wrote on last edited by
                              #86

                              this is the folder where QtC stores Settings on windows ?
                              I never use the default settings location for QtC to avoid problems if different QtC versions are installed. I always start QtC with a specific settings folder for each installation.

                              ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                              5.15 --> 6.9 https://t1p.de/ekkeChecklist
                              QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                              1 Reply Last reply
                              0
                              • KenAppleby 0K Offline
                                KenAppleby 0K Offline
                                KenAppleby 0
                                wrote on last edited by KenAppleby 0
                                #87

                                I have just discovered that you can trigger this problem simply by unchecking:

                                Edit -> Preferences ... -> Build & Run -> "Always deploy project before running it"

                                then making changes and rebuilding the project.

                                Turning this option back on solves the problem - without having to use the sledgehammer of removing the AppData/Roaming/QtProject folder!

                                It makes sense, I suppose, though I believe this was not the case in earlier versions of Qt. I am using QtCreator 14.0.1 on Qt6.7.2.

                                1 Reply Last reply
                                0

                                • Login

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