Qt Creator can't find ANDROID_NDK_ROOT environment variable

  • Re: Qt + Android (ANDROID_NDK_ROOT environment variable...)

    I used Qt Maintenance Tool to confirm that I installed all the Android related stuff for Qt v5.13.2. Then, I used the following link to install the v2.1 Android NDK on my Ubuntu platform:

    But, note, that procedure EXPORTs the android NDK's folder to PATH, but does NOT set the ANDROID_NDK_ROOT environment variable. Hence, here is all the android NDK stuff I added to the end of my .bashrc file:

    Android NDK stuff

    export PATH=$PATH:~/android-ndk-r21

    After that, issuing this bash cmd confirmed that my platform knows where the android NDK is:
    which ndk-build

    And, issuing this bash cmd confirmed that the environment variable was now known by my platform:

    Nevertheless, Qt Creator's General Messages window reported it could not find the ANDROID_NDK_ROOT environment variable, And, sure enough, the Build Settings of Qt Creator's Project dialog dialog did NOT list the ANDROID_NDK_ROOT environment variable, not even after I rebooted my computer.

    I manually added the ANDROID_NDK_ROOT variable to Build Settings and that got rid of this problem.

    Oh, but it gets better. I then unset that variable from the Build Settings and QT Creator NOW no longer gets the General Messages warning, even though Build Settings no longer lists the ANDROID_NDK_ROOT variable.

    Now, I avoid reinstalling Qt from scratch every time some weird issue like this arises, mainly because even if that 'kludge' works, you still do not know WHY it now works.

    Ergo, I no longer have the problem, but I STILL don't know why Qt now can find the installed Android NDK. I am posting this because this HAS to be some deficiency in how Qt Creator processes system environment variables (not just ANDROID_NDK_ROOT) and I am hoping some codemeister will read this and a light bulb will go on over his head as he experiences that infamous AH-HA moment.

  • Lifetime Qt Champion

    @istlota101 In QtCreator you can actually define where NDK is on the "Devices" tab in Options

Log in to reply