I cannot set up Qt/QtCreator for android development. ANDROID_NDK_ROOT problems.
-
wrote on 14 Jul 2020, 19:32 last edited by
Ive been stumped by this for about 4 days now. Any help would be appreciated. If anyone knows how to get or see more verbose error logging that would help too. Some of these errors aren't very helpful.
System and Versions:
Windows 10
Qt Creator 4.12.4
Based on Qt 5.14.2 (MSVC 2017, 32 bit)All Android SDK/NDK/Tools etc were installed using Android Studio before installing Qt (I actually uninstalled everything and started from scratch this way).
SDK Build Tools: 30.0.1 and 29.0.2
NDK (Side by Side): 20.1.5948944 and 21.3.6528147Problem:
I can't set up for android development.
Options > Devices > Android (tab)
under Android Settings I have "Android settings have errors". There is a list of necessary components and all of them have green checks except for one: "All essential packages installed for all installed Qt versions." This one has a red x. Java and OpenSSL are ok here, this is the only problem on this page.A popup occurs when I open this page:
Title: "Missing Android SDK packages - Qt Creator"
Body: "Android SDK installation is missing necessary packages. Do you want to install the missing packages?"If I say Yes, popup goes away and nothing happens. When I click OK or Apply from here I get an error in "General Messages":
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK. Could not read qmake configuration file C:/Qt/5.15.0/android/mkspecs/android-clang/qmake.conf.
So I tried adding it to my Windows 10 environment variables.
Name: ANDROID_NDK_ROOT
Value: C:\Users\X\AppData\Local\Android\Sdk\ndk\21.3.6528147No effect. Tried targeting my r20 ndk, also no effect. Tried User vs System variables as well (all 4 combinations) no effect.
The qmake.conf file it complains about exists and looks fine to me. Tried running QtCreator as admin just in case there was some kind of permission thing. No dice.
This is without a project! I sometimes see advice about changing settings for your project. I am doing this without opening/starting a project yet, just trying to set things up.
Thank you.
-
Ive been stumped by this for about 4 days now. Any help would be appreciated. If anyone knows how to get or see more verbose error logging that would help too. Some of these errors aren't very helpful.
System and Versions:
Windows 10
Qt Creator 4.12.4
Based on Qt 5.14.2 (MSVC 2017, 32 bit)All Android SDK/NDK/Tools etc were installed using Android Studio before installing Qt (I actually uninstalled everything and started from scratch this way).
SDK Build Tools: 30.0.1 and 29.0.2
NDK (Side by Side): 20.1.5948944 and 21.3.6528147Problem:
I can't set up for android development.
Options > Devices > Android (tab)
under Android Settings I have "Android settings have errors". There is a list of necessary components and all of them have green checks except for one: "All essential packages installed for all installed Qt versions." This one has a red x. Java and OpenSSL are ok here, this is the only problem on this page.A popup occurs when I open this page:
Title: "Missing Android SDK packages - Qt Creator"
Body: "Android SDK installation is missing necessary packages. Do you want to install the missing packages?"If I say Yes, popup goes away and nothing happens. When I click OK or Apply from here I get an error in "General Messages":
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK. Could not read qmake configuration file C:/Qt/5.15.0/android/mkspecs/android-clang/qmake.conf.
So I tried adding it to my Windows 10 environment variables.
Name: ANDROID_NDK_ROOT
Value: C:\Users\X\AppData\Local\Android\Sdk\ndk\21.3.6528147No effect. Tried targeting my r20 ndk, also no effect. Tried User vs System variables as well (all 4 combinations) no effect.
The qmake.conf file it complains about exists and looks fine to me. Tried running QtCreator as admin just in case there was some kind of permission thing. No dice.
This is without a project! I sometimes see advice about changing settings for your project. I am doing this without opening/starting a project yet, just trying to set things up.
Thank you.
wrote on 20 Jul 2020, 18:07 last edited bySo my question has been up for a week. No one has any ideas?
In this time I installed this environment on my linux machine and with little drama everything is working. I deployed a basic android project to my phone and to a virtual device. I want to get windows working too. But nothing I try solves the problem or even tells me what the problem is.
This feels like a bug to me. To recap here are the strange things I'm seeing:
-
"Android SDK installation is missing necessary packages. Do you want to install the missing packages?" > Yes > Nothing happens. I get a whiff of: it wants to download the NDK but for some reason can't. If I have no NDK installed it does this, but it also does this if I install it (manually, AndStud SDK manager, or Qt SDK manager). Most of all what I really want to see here is more information about what is missing and what it is trying to do. It only shows "All essential packages installed for all installed Qt versions" being a problem which tells me nearly nothing.
-
This error: Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK. Could not read qmake configuration file C:/Qt/5.15.0/android/mkspecs/android-clang/qmake.conf. It is clearly not fixed when I add it to my environment variable. I also don't have a project open which is confusing.
One last piece of information: If I go to Tools > Options > Kits > Qt Versions (tab) > Select Qt 5.15.0 for Android. The error listed here is "Failed to detect the ABIs used by the Qt version. Check the settings in Devices > Android for errors." This is of course the place where I have been doing everything else I have mentioned above.
What is the procedure here for escalating this?
-
-
wrote on 31 Jul 2020, 16:51 last edited by WatermelonJesus
Well, this community was absolutely no help at all. Yet in case someone else comes along with this same problem (which I still would call a bug, more verbose errors should be given here), I want to explain how it was solved.
- My JDK was version 8 as instructed, but it was 8u181 and there is an update: 8u261 that I needed. I actually had to make an account with oracle to download this because its not their newest JDK. That is their policy for some reason.
- Once this was updated the same "Do you want to install missing packages" popped up but this time it directed me to an NDK download (like I suspected). Once downloaded all the errors were cleared and I could add an android kit to a project.
- I still was unable to add an AVD from the Qt AVD manager, though deploying directly to my pixel 3a worked. When trying to add, I couldn't select any SDK's and it said I needed an API of at least version 0 (so it wasn't seeing anything). The solution for me was simply to install Android Studio. In this iteration of trying to fix my problem I was using only Qt's managers. AS I guess managed the AVD's better and suddenly I could deploy to a virtual pixel 3a with Qt. I did nothing but install Android Studio. I didn't even open the AS AVD manager.
One last thing: The ANDROID_NDK_ROOT error soldiers on. Yet it doesn't seem to affect anything.
-
wrote on 29 Jan 2022, 23:14 last edited by Vega4
Just wanted to point out that in another topic I wrote that "I know that QT Creator can now at least set up Android development by itself" (..) just installed QT latest release 6.0+ and guess what? It can't same thing as here described. Downloaded the alternative JDK (not by oracle, the the to which the In-creator-button leads to (!) .... pointed QR creator to it (was NOT auto-detected, even after restarting QT Creator) clicked Set Up SDK//a download went to 100%.. disappeared... nothing.... restarted QT creator.. nothing. .guess.. on unknown grounds yet again... or just gotta check from another.. 'miraculously' working instance... what the 'proper' JDK version actually is.. and whether official by oracle or not.
I strongly feel that this piece of software SHOULD be distributed as a standalone 'VM'. And no it's not a joke. That's from experience of a person who's installed QT Creator like 20+ times over many years.
So to make my input more constructive, and not entirely pointless.
Seems like auto-setup functionality in recent QT Creator (6+) is broken.
Was unable to go about it with neither official nor Eclipse-org-based ones ..1.8 JDK. I tried, on Windows 10 x64.
Went ahead with manual process as described here https://doc.qt.io/qt-6/android-getting-started.html and.. as the cmd-line based installer downloaded and installed everything (including NDK 22.1.717670)... QT creator neglected it.. decided that it needs 6 more packages including ndk;21.3.6528147.. platform tools.. ). Ended up with 3 folders containing platform tools with suffixes from 0 to 3.. now which ones to delete ..;p
And then.. it decided it needs to install
[Packages to be installed:]
Android SDK Build-Tools 30.0.2
Android SDK Command-line Tools (latest)
Android SDK Platform-Tools
NDK (Side by side) 21.3.6528147
Android SDK Platform 30
Google USB DriverAll over... AGAIN.
Update 3: For f*** sake can't figure out what's wrong with it again. It keeps complaining about missing stuff, everything was installed. Wiping entire (fresh!) installation of QT Creator again and re-downloading
Never happened to me before.
-
wrote on 29 May 2022, 17:24 last edited by
I'm having the same issue. I had nothing installed on my Linux desktop for doing Android development, other than having checked the Android (and all) boxes during Qt 6.3.0 install. The Qt page instructed me to install the JDK. So, I installed the now named Temurin JDK via apt-get. The page then instructed me to install Gradle. So, I did that. Qt Creator then saw the JDK. I pressed the Set Up SDK button for Android. It seems to have downloaded and installed the Android SDK tools. It then said I needed additional packages. I gave me a license agreement to accept. I clicked the Yes button. The progress bar quickly went to 17% and then stayed there forever. I canceled and tried again. I got the same license agreement. The progress bar instantly jumps to 17% and does not move. I'm stuck. Has anyone figured this out? Do I just abandon letting Qt Creator do this and try the manual steps?
-
wrote on 30 May 2022, 18:39 last edited by
I had installed the latest temurin (previously AdoptOpenJDK) JDK, which was 17. The Qt page describing prerequisites (https://doc.qt.io/qt-6/android-getting-started.html#manually-installing-the-prerequisites) clearly states "Java Development Kit 11 (JDK) or above" (emphasis mine). Thinking the "or above" may be wrong, I uninstalled 17 and installed 11. Now the Set Up SDK button on the Android devices page got further on installing packages. It installed the sdk manager. But, it still hung on a later package. The Qt Android device page mentions requiring JDK 8 if using below a certain version of the Android SDK. Well, it installed the SDK. And, trying to run sdkmanager --version just threw errors. Frustrated, I uninstalled JDK 11 and installed 8. Now the Set Up SDK process completed! The Android device page says all is ok. I attached my Android phone. I built my app for the Android x86_64 kit. The build fails saying Gradle requires JDK 11. So, Gradle requires a JDK that, if you have it installed, won't work with the 'Set Up SDK' Qt feature. What am I missing. This could not be more frustrating.
-
wrote on 30 May 2022, 18:54 last edited by JoeCFD
As a coder, you may need some patience. But it is true that Qt docu is not good enough for android apps.
- use Open JDK 11. Higher than this one will not work.
- Check https://docs.gradle.org/current/userguide/compatibility.html for gradle compatibility. Gradle version number of Qt is defined here.
qtpath/android/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties - download android studio and install related packages from there.
- set proper ENV variables. Some are here:
export JAVA_HOME=path/jdk-11.0.2
export ANDROID_HOME=path/Android/Sdk
export ANDROID_NDK_HOST=linux-x86_64
export ANDROID_NDK_PLATFORM=android-21
export ANDROID_NDK_ROOT=path/Android/Sdk/ndk/21.3.6528147
export ANDROID_SDK_ROOT=path/Android/Sdkand Qt works on Android.
-
wrote on 30 May 2022, 22:33 last edited by
Thank you for the reply! After reading your post, I tabbed back over to Qt Creator. I noticed in the output that, even though I changed the JDK path in the Android Device tab, the build was still trying to use JDK 8. I closed and re-opened Qt Creator and built again. It succeeded. So, I guess I had to run JDK 8 for the Qt setup to work, then switch to 11, but close and re-open Qt Creator after the switch. My excitement was quickly dashed. When I try to run the app on my phone, I just get a solid white screen. The app does not show up.
-
Thank you for the reply! After reading your post, I tabbed back over to Qt Creator. I noticed in the output that, even though I changed the JDK path in the Android Device tab, the build was still trying to use JDK 8. I closed and re-opened Qt Creator and built again. It succeeded. So, I guess I had to run JDK 8 for the Qt setup to work, then switch to 11, but close and re-open Qt Creator after the switch. My excitement was quickly dashed. When I try to run the app on my phone, I just get a solid white screen. The app does not show up.