Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT for Android on macOS



  • Hope to get some help here in case of Android and QT. I really do not want to judge anything here, but in my eyes, professional is far away from that what I run into. Unbelievable that the App Store is full of apps.

    However. Iam on macOS. I want to create a simple app with an own written library. But I fail at just the basic app without any action.

    In my QT, QTCreator 4.11.1 and QT 5.14.1 I always get an empty Anroid Build SDK selection box. Screenshot 2020-03-14 at 09.29.15.png

    OK, I read many threads and discussion and first I thought it is a bug. So I edited the pro.user file and added the build version (android-29) to the 3 empty nodes. Voila, the QTCreator compiled the app. I was surprised but only until I want to test the app. I was not able to create a virtual device because, the target SDK / Build was also missing in the virtual device dialog. I thought wow...what professional.

    So I continue with my research and finally I go to the KIT and try to figure out problems. I installed the JDK 8 and linked this in the settings. No success. I downloaded a couple of SDKs and NDKs but finally ALL reported a Red Cross at Tools installed and Platform SDK installed. Iam wondering this because I downloaded them from google with Android Studio. Really amazing. Also a wide range of combination out of JDK, SDK and NDK did not changed anything.
    Screenshot 2020-03-14 at 09.33.06.png

    I always read to install Android SDK manually, but my experience is, it is only possible with the Android Studio. So I tried Android Studio 3,6 an also 4 no change. Never got removed the Red Cross on the 2 points. Iam desperate...

    SO please community, is here someone who can create and test a android app with QT and not with 2 years old SDK / NDK combination? Iam also happy about a guide or a YouTue video, but before I kill myself, a way how it works.



  • Yeah, I'm having the exact same problem and I only figured out that if you moved the files from the "cmdline-tools/latest" to a new folder "tools" in the top level of the sdk folder it will put a green check for the "SDK tools installed" error but I couldn't fix the "Platform SDK installed" error no matter what I did. I'm going to try it on windows after I format my PC and get a 64-bit Windows up and running with the same versions on my Mac.

    I think the "SDK tools installed" error is ust thae fact that the newer SDK versions have a different file structure than the old ones and that's why it is showing an error and my solution fixes it but it still produces error in the command line output when you run the sdkmanager command.

    EDIT: I think the Qt company should tell the users about the currently working version combinations of the Android SDK & NDK.


  • Moderators

    @pixbyte please show your device page inside QtCreator with the android tab open and especially zoomed out! From that screen shot we can see nothing ;)

    also did you run the sdk manager after installing? so that sdk tools could be downloaded and installed ?

    If you select the sdk page, what is shown and check marked?

    I always read to install Android SDK manually, but my experience is, it is only possible with the Android Studio. So I tried Android Studio 3,6 an also 4 no change. Never got removed the Red Cross on the 2 points. Iam desperate...

    This is potential error, multiple sdk/ndk installations can cause issues, especially as Android studio tends to add them globally to the path. The reason why I only use the command line tools.

    SO please community, is here someone who can create and test a android app with QT and not with 2 years old SDK / NDK combination? Iam also happy about a guide or a YouTue video, but before I kill myself, a way how it works.

    Here's the thing about google, and its SDK's don't jump on the newest release! They regularly break compatibility from one update to an other! Don't fix what's not broken, also not every Qt Version works with ever y SDK/NDK combination.

    I'm personally using:
    jdk1.8.0_192
    SDK Version: 26.1.1,
    NDK Version: 18.1.5063045
    and Qt 5.12.6

    no issues what so ever.


  • Lifetime Qt Champion

    Hi,

    @HatEmU said in QT for Android on macOS:

    EDIT: I think the Qt company should tell the users about the currently working version combinations of the Android SDK & NDK.

    This information is available on the Android Getting Started guide. However as @J-Hilk noted, the Android folks have a tendency to break things with new releases.


  • Moderators

    Also I just found this bugreport
    https://bugreports.qt.io/browse/QTCREATORBUG-23726?jql=text ~ "android sdk" ORDER BY created DESC

    seems like it could fit your situation.
    Check the link it has workarounds for it.



  • @pixbyte I've solved the problem, my friend! I knew it was because of the version and the different file structure that the latest Android SDK has. The solution is simple and as follows:

    1. Open android studio and go to the SDK Manager configurations
    2. Go to the SDK Tools tab and in the very bottom right of the window you will see 2 checkboxes: Uncheck the "Hide Obsolete Packages"
    3. Download the "Android SDK Tools (Obsolete)" Package which is version 26.1.1
    4. Go to Qt Creator and, VoilĂ , it works

    All thanks to @J-Hilk because he provided valuable info and coming in clutch with his versions in a nice response, can't thank him enough!

    Note: Flutter has a nice, big warning for users about this issue and they say it will be addressed in future releases.



  • I currently understand nothing, to be honest.

    It is impossible to work with QT and Android for me on Linux and also in Mac. I do not want to know how many hours I lost in reading wrong comments and in following wrong tips and Finlay it still do not work.
    What is wrong here?

    Is there any guide how to set up QT for Android on Linux (Ubuntu) or macOS that works?

    My workspace:

    • Android Studio 3.6.1
    • QT (which version works?)
    • Android SDK (29,28,27....?)
    • NDK
    • What kind of JDK?

    I only have the possibility to use Android Studio to download the needed SDKs and Tools. And it doesn't matter what I do, I have always red crosses in the config screen. And this on two different OS.

    Currently we have hundreds of "solutions" here that definitely do not work and that definitely base one outdated software. Please guys, I just want to create a simple Android app with QT...just a little one :-(


  • Moderators

    @pixbyte
    this is the one I'm using:
    69c78006-cd76-482a-8be5-2b8d5f759c64-image.png

    together with Qt 5.12.6

    Been using since the launch of 5.12 and will use it untill 5.12 is no longer supported. Or google requires a new min SDK



  • maybe you can send a screenshot that represent the library and library/android folder?
    How you downloaded the SDK/NDK and Tools. With Android Studio?



  • @pixbyte I use Qt for Android on Linux Mint and it works fine (but I haven't updated it in 6 months). I use Android Studio to manage the SDK/NDK. All I did was follow the Qt documentation. Also, I installed Android Studio before Qt. If you do that it should "just work". I installed everything to /home/opt (probably /opt for you).

    Qt Creator 4.9.2
    Qt 5.12.1
    Linux Mint 19.3

    Screenshot from 2020-04-03 15-43-16.png



  • Ok, the main sector is definitely the jre delivered with Android Studio. Thanks you for your help guys. It works now like a charme.


Log in to reply