Unable to build to android. (Newbie)
Hello everyone. I am new to QT and I am trying to build to Android.
I have installed Android studio and downloaded Android SDK, NDK and JDK and everything is hooked up to QT Creator, however when I try to build my project for Android I get this.
Is there anything that I did wrong?
I tried installing API levels from 20 to 28, and I tried compiling to each of them and I still get the same error.
FAILURE: Build failed with an exception. * Where: Build file 'D:\PROJECTS\QT\build-MobileTest2-Android_for_x86_Clang_Qt_5_12_1_for_Android_x86-Debug\android-build\build.gradle' line: 39 * What went wrong: A problem occurred evaluating root project 'android-build'. > Invalid revision: android-7.1.1 * 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 7s Building the android package failed! -- For more information, run this command with --verbose. 19:24:58: The process "C:\Qt\5.12.1\android_x86\bin\androiddeployqt.exe" exited with code 14. Error while building/deploying project MobileTest2 (kit: Android for x86 (Clang Qt 5.12.1 for Android x86)) When executing step "Build Android APK"
hi @elopez7 and welcome
a couple of questions up front, because I can't find the info in your post.
What version of JDK, NDK ans SDK are you using? Qt does not work with all combination and the working combination changed with the introduction of Qt 5.12
Also, you're building for x86 architecture that is the less common one, do you know that? And did you install the precompiled x86 libs of Qt and not only the armv7/8 ones?
Did you install both, and did you than select the correct one ?
@elopez7 Before building your application, test your installation by first building an app from Android Studio, and then build one of the example Android projects from Qt Creator. Do those work?
A bit grain of salt from personal experience.
I always had problems with Qt & Android when I had also installed Android Studio on my PC, so much that I once had to rest my PC.
Since then I'm using the command line tools exclusively.
Hi @J.Hilk and thank you.
Admittedly at first I was using different version of each because I had downloaded them separately.
I am now using everything that comes bundled with Android Studio, but I am still getting the same error. I will paste the full log in case that could be of any help. I am also uploading some screenshots showing my Android configuration in QT.
@Tom_H I tried building an app from Android Studio and it worked perfectly, I tried building one of the examples and it throws a different error "type_traits" doesn't exist.
I did not know about building for x86. Now, what would be the best combination that works for QT?
I thank you guys for your help.
Here is the full log
initializing deployment to Android device/simulator Deploying to HAAXB761F57838K 08:00:59: Running steps for project MobileTest2... 08:00:59: Configuration unchanged, skipping qmake step. 08:00:59: Starting: "C:\NVPACK\android-ndk-r12b\prebuilt\windows-x86_64\bin\make.exe" -j8 make: Nothing to be done for `first'. 08:01:01: The process "C:\NVPACK\android-ndk-r12b\prebuilt\windows-x86_64\bin\make.exe" exited normally. 08:01:01: Removing directory D:\PROJECTS\QT\build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug\android-build/assets 08:01:01: Removing directory D:\PROJECTS\QT\build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug\android-build/libs 08:01:01: Starting: "C:\NVPACK\android-ndk-r12b\prebuilt\windows-x86_64\bin\make.exe" "INSTALL_ROOT=D:\PROJECTS\QT\build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug\android-build" install C:\Qt\5.12.1\android_arm64_v8a\bin\qmake.exe -install qinstall -exe libMobileTest2.so D:\PROJECTS\QT\build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug\android-build\libs\arm64-v8a\libMobileTest2.so 08:01:02: The process "C:\NVPACK\android-ndk-r12b\prebuilt\windows-x86_64\bin\make.exe" exited normally. 08:01:02: Starting: "C:\Qt\5.12.1\android_arm64_v8a\bin\androiddeployqt.exe" --input D:/PROJECTS/QT/build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug/android-libMobileTest2.so-deployment-settings.json --output D:/PROJECTS/QT/build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug/android-build --android-platform android-28 --jdk C:/NVPACK/jdk1.8.0_77 --gradle Generating Android Package Input file: D:/PROJECTS/QT/build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug/android-libMobileTest2.so-deployment-settings.json Output directory: D:/PROJECTS/QT/build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug/android-build/ Application binary: D:/PROJECTS/QT/build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug/libMobileTest2.so Android build platform: android-28 Install to device: No FAILURE: Build failed with an exception. * Where: Build file 'D:\PROJECTS\QT\build-MobileTest2-Android_for_arm64_v8a_Clang_Qt_5_12_1_for_Android_ARM64_v8a-Debug\android-build\build.gradle' line: 39 * What went wrong: A problem occurred evaluating root project 'android-build'. > Invalid revision: android-7.1.1 * 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 7s -- Skipping C:/Qt/5.12.1/android_arm64_v8a/plugins/iconengines/libqsvgicon.so. It has unmet dependencies: lib/libQt5Svg.so. -- Skipping C:/Qt/5.12.1/android_arm64_v8a/plugins/imageformats/libqsvg.so. It has unmet dependencies: lib/libQt5Svg.so. Building the android package failed! -- For more information, run this command with --verbose. 08:01:14: The process "C:\Qt\5.12.1\android_arm64_v8a\bin\androiddeployqt.exe" exited with code 14. Error while building/deploying project MobileTest2 (kit: Android for arm64-v8a (Clang Qt 5.12.1 for Android ARM64-v8a)) When executing step "Build Android APK" 08:01:14: Elapsed time: 00:15.
Here are the screenshots of my configuration
your ndk version is way to old. Qt 5.12 requires one that is able to use clang. The doc suggest to use the newest available.
see the android started guide
@J.Hilk I could have sworn that the SDK manager installed the latest NDK.
I updated manually and now it works. Thank you so much for your help!