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. build fails for android
Forum Updated to NodeBB v4.3 + New Features

build fails for android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
9 Posts 3 Posters 923 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.
  • K Offline
    K Offline
    kgregory
    wrote on 11 Oct 2024, 02:21 last edited by
    #1

    I've setup my Qt build environment on a new computer and imported my project. I haven't tried to compile the project in a few months, but I was able to get it to build back then.

    The error messages are kind of vague... any ideas on how to troubleshoot this? I did make sure to enable the build steps to sign the package since that's tripped me up before.

    The build output below is followed up by a ton of "unqualified access" warnings in one of my qml files. I've never seen those before and not sure what they mean, so not sure if it's relevant to the build failure...

    :-1: warning: Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Windows
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.macOS
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.iOS
    Warning: QML import could not be resolved in any of the import paths: myClass.colorbackend
    
    :-1: error: FAILURE: Build failed with an exception.
    
    :-1: error: * What went wrong:
    A problem occurred configuring root project 'android-build'.
    > Could not open cp_proj generic class cache for build file 'D:\Projects\GUIs\MyApp\build\Android_Qt_6_8_0_Clang_arm64_v8a-Release\android-build\build.gradle' (C:\Users\myname\.gradle\caches\8.0\scripts\94wrdb4esibgi6m4j6pctxpgr).
    
    :-1: error:    > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
    
    * 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
    
    BUILD FAILED in 2s
    
    :-1: error: Building the android package failed!
      -- For more information, run this command with --verbose.
    
    J 1 Reply Last reply 11 Oct 2024, 06:38
    0
    • K Offline
      K Offline
      kgregory
      wrote on 22 Oct 2024, 03:09 last edited by
      #9

      OK I got it working. After that last post, I decided to enable signing the package. After doing that, I'm able to build and run my application. I wish Qt would remind me/force me to sign the package before I hit build if it's required for me to sign the package because this has tripped me up in the past (very cryptic error message).

      Anyway, thanks for all the help!

      1 Reply Last reply
      1
      • K kgregory
        11 Oct 2024, 02:21

        I've setup my Qt build environment on a new computer and imported my project. I haven't tried to compile the project in a few months, but I was able to get it to build back then.

        The error messages are kind of vague... any ideas on how to troubleshoot this? I did make sure to enable the build steps to sign the package since that's tripped me up before.

        The build output below is followed up by a ton of "unqualified access" warnings in one of my qml files. I've never seen those before and not sure what they mean, so not sure if it's relevant to the build failure...

        :-1: warning: Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Windows
        Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.macOS
        Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.iOS
        Warning: QML import could not be resolved in any of the import paths: myClass.colorbackend
        
        :-1: error: FAILURE: Build failed with an exception.
        
        :-1: error: * What went wrong:
        A problem occurred configuring root project 'android-build'.
        > Could not open cp_proj generic class cache for build file 'D:\Projects\GUIs\MyApp\build\Android_Qt_6_8_0_Clang_arm64_v8a-Release\android-build\build.gradle' (C:\Users\myname\.gradle\caches\8.0\scripts\94wrdb4esibgi6m4j6pctxpgr).
        
        :-1: error:    > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
        
        * 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
        
        BUILD FAILED in 2s
        
        :-1: error: Building the android package failed!
          -- For more information, run this command with --verbose.
        
        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 11 Oct 2024, 06:38 last edited by
        #2

        @kgregory Did you start with a clean build folder on the new machine?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        K 1 Reply Last reply 13 Oct 2024, 02:56
        0
        • J jsulm
          11 Oct 2024, 06:38

          @kgregory Did you start with a clean build folder on the new machine?

          K Offline
          K Offline
          kgregory
          wrote on 13 Oct 2024, 02:56 last edited by
          #3

          @jsulm yes, I did

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kgregory
            wrote on 17 Oct 2024, 03:15 last edited by
            #4

            bump. really could use some help on this, I'm still stuck. Thanks!

            1 Reply Last reply
            0
            • J Offline
              J Offline
              J.Hilk
              Moderators
              wrote on 17 Oct 2024, 06:07 last edited by
              #5

              try a new empty project and let QtC generate all android files for you.

              Sometimes android breaks backwards compatibility, so changes must be made. Usually The QtCompany adjusts this in the defaults, but that also means already existing projects need to be adjusted by hand


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              1
              • K Offline
                K Offline
                kgregory
                wrote on 18 Oct 2024, 03:19 last edited by
                #6

                So I gave this a shot and I noticed a couple of things but I'm not quite sure how to proceed in terms of getting my project working.

                1. CMake seems to be the new preferred build platform. My project is built around QMake. Is it worth my trouble to learn CMake and translate it over or should I keep it in QMake?
                2. I tried both QtQuick Application project templates for CMake and for Qmake. I noticed they are both quite bare. I have a handful of gradle configuration files but neither of these projects have that. Should I delete the gradle configurations or do I still need them? (I'm kind of suspicious of gradle because it's been the problem after previous updates)
                3. Neither of the two QtQuick successfully deploy to my device. I see my device's screen go to a blank white and then I get the error message "org.qtproject.example.DummyProject2" died. adb.exe: device 'R5CN20A396M' not found. It looks like it should have printed "hello world". Should I expect these projects to be able to deploy?
                J 1 Reply Last reply 18 Oct 2024, 06:06
                0
                • K kgregory
                  18 Oct 2024, 03:19

                  So I gave this a shot and I noticed a couple of things but I'm not quite sure how to proceed in terms of getting my project working.

                  1. CMake seems to be the new preferred build platform. My project is built around QMake. Is it worth my trouble to learn CMake and translate it over or should I keep it in QMake?
                  2. I tried both QtQuick Application project templates for CMake and for Qmake. I noticed they are both quite bare. I have a handful of gradle configuration files but neither of these projects have that. Should I delete the gradle configurations or do I still need them? (I'm kind of suspicious of gradle because it's been the problem after previous updates)
                  3. Neither of the two QtQuick successfully deploy to my device. I see my device's screen go to a blank white and then I get the error message "org.qtproject.example.DummyProject2" died. adb.exe: device 'R5CN20A396M' not found. It looks like it should have printed "hello world". Should I expect these projects to be able to deploy?
                  J Offline
                  J Offline
                  J.Hilk
                  Moderators
                  wrote on 18 Oct 2024, 06:06 last edited by
                  #7

                  @kgregory

                  1. for new projects I would suggest using/learning cmake it is the more popular and refined build system and used outside of Qt, you will benefit more.
                    But currently I see no direct tangible benefit in porting already existing project.

                  2. If you did not modify your gradle build, but you're good with the default I would suggest let Qt/QtCreator handle that part

                  3. Yes, you should be able to deploy standard barebone projects! You're using 6.8 I saw, did you update ndk, sdk etc to be to the QtVersion ?
                    See here:
                    https://doc.qt.io/qt-6/android-getting-started.html


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  K 1 Reply Last reply 20 Oct 2024, 03:41
                  2
                  • J J.Hilk
                    18 Oct 2024, 06:06

                    @kgregory

                    1. for new projects I would suggest using/learning cmake it is the more popular and refined build system and used outside of Qt, you will benefit more.
                      But currently I see no direct tangible benefit in porting already existing project.

                    2. If you did not modify your gradle build, but you're good with the default I would suggest let Qt/QtCreator handle that part

                    3. Yes, you should be able to deploy standard barebone projects! You're using 6.8 I saw, did you update ndk, sdk etc to be to the QtVersion ?
                      See here:
                      https://doc.qt.io/qt-6/android-getting-started.html

                    K Offline
                    K Offline
                    kgregory
                    wrote on 20 Oct 2024, 03:41 last edited by kgregory
                    #8

                    @J-Hilk said in build fails for android:

                    You're using 6.8 I saw, did you update ndk, sdk etc to be to the QtVersion ?

                    OK this got me a step closer. I had installed the correct NDK along with a few others and I overlooked the step of telling Qt which one to use. Now, it looks like I can now deploy the base project on my phone successfully.

                    However, when I run my application, it's still failing to build. I tried deleting all of my gradle files as well as running clean & qmake. I still get this result.

                    a8f901a3-1b8f-46d6-aa33-83bb7c68cd91-image.png

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kgregory
                      wrote on 22 Oct 2024, 03:09 last edited by
                      #9

                      OK I got it working. After that last post, I decided to enable signing the package. After doing that, I'm able to build and run my application. I wish Qt would remind me/force me to sign the package before I hit build if it's required for me to sign the package because this has tripped me up in the past (very cryptic error message).

                      Anyway, thanks for all the help!

                      1 Reply Last reply
                      1
                      • K kgregory has marked this topic as solved on 22 Oct 2024, 03:09

                      • Login

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