build fails for android
-
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.
-
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!
-
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
-
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.
- 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?
- 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)
- 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?
-
-
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. -
If you did not modify your gradle build, but you're good with the default I would suggest let Qt/QtCreator handle that part
-
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
-
-
@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.
-
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!
-