Qt + Android (ANDROID_NDK_ROOT environment variable...)



  • Hello all,

    I have some trouble to cross compile a small Qt programm and load it into a Samsung Tab 4 device.

    First of all this is my configuration:
    Ubuntu 15.04
    Processor Intel Core 2 Duo CPU T7500 @ 2.20GHz*2
    OS type 32 bit
    Qt 5.5.0

    So I download all what I needed (ant, java, ndk and sdk).
    I did all the configuration part inside Qt in tools/options following several tutorials

    On Android configuration, it found 8 compilation toolchains and ticked the box to create them automatically
    In Compile and Run, I found the 8 ones under the compiler tab.
    I have created a kit manually (only the desktop one was auto detected) and getting this warning:
    the compiler ... cannot produce code for the Qt version Qt 5.5.0 32 bits

    When I open a project I get this message:
    /bin/sh: 1: /toolchains/x86-4.9/prebuilt/linux-x86/bin/i686-linux-android-gcc: not found
    Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
    Could not read qmake configuration file /home/damien/Qt5.5.0/5.5/gcc/mkspecs/android-g++/qmake.conf.

    So far what I have done that trying to solve the problem:
    1°) on bashrc I added the following export path:
    export ANDROID_HOME=/home/damien/android-sdk-linux
    export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
    export ANDROID_HOME=/home/damien/android-ndk-r10e
    export ANDROID_SDK_ROOT=/home/damien/android-sdk-linux
    export ANDROID_NDK_ROOT=/home/damien/android-ndk-r10e
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    export PATH=$PATH:$ANDROID_SDK_ROOT/tools
    export PATH=$PATH:$ANDROID_NDK

    2°) I gave all the rights to NDK by using chmod 777

    I still have the same problem and I passed at least 2 days to find on Internet what's going on.
    Does anyone have a shrink idea how to solve this problem?

    Thanks in advance,
    Damien



  • @Garfield Hi, I documented this error some time ago while using Qt for Android and it looks like setting ANDROID_NDK_ROOT was enough.

    I checked again my dev environment, and the only variables set are:

    ANDROID_NDK_ROOT=C:\devtools\android-ndk-r9c
    ...
    JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
    ...
    Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Ja
    va\jdk1.7.0_25\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Java\jdk1.7
    .0_25\jre\bin\server;C:\Python27\Lib\site-packages\PyQt4;C:\Python27;C:\Python2
    7\Scripts;C:\Perl\site\bin;C:\Perl\bin;C:\devtools\android-sdk-windows\platform-
    tools;C:\Users\pablo\AppData\Roaming\Python\Scripts;C:\Ruby200\bin



  • @Pablo-J.-Rogina Hello Thanks for your quick reply;
    Actually, I added so many paths on bashrc to be sure to resolve the problem.
    It didn't work even by just adding one.

    Do you have any others idea?

    Greetings,
    Damien



  • Well, I'll start from scratch. I first install Android SDK, Android NDK, Ant and Java and set the required environment variables, as few as possible. Then I'll install Qt so Qt Creator will find (hopefully) everything automatically and you 'll have the kits set in Qt Creator with the proper values. Just my two cents.



  • @Pablo-J.-Rogina
    So you think that installing SDK and NDK before Qt creator has an impact?
    What should I do then? uninstall Qt and install it again?



  • I guess that having the Android components in place before installing Qt may help you.
    Yes, uninstall Qt and install it only after you have installed all required components (Android SDJ, NDK, Ant and Java) and setting the required environment variables.



  • Ok I will do that exactly now. thanks in advance



  • So I uninstalled Qt and removed all the files in the folder.
    Nevertheless, when I reinstall it, I still get the same results and Qt creator kept also the old config. i.e the manual kit I've created


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    IIRC, the Android SDK/NDK doesn't install the x86 compilers by default, you have to add them yourself using their management tool



  • Hi thanks for your reply,

    I guess I have installed all the compilers availaible using SDK manager.
    8 toolchains were found by Qt.
    I reinstalled everything from scratch (ubuntu, sdk, ndk, qt etc...) and it did not solve the problem.

    I know that my problem must be a stupid thing but I just don"t get it and it frustrates me a lot.
    do you have any other idea how to proceed?

    Thanks in advance,
    damien



  • By the way, I found that the Intel Core 2 Duo CPU T7500 is a 64 bits one.
    I have installed Ubuntu 32 bits because there was no added value for me to install a 64 bits one.
    for some compatibility reasons I kept also a 32 bits one when I started to use Ubuntu 4 years ago

    Do you think that it could potential be the source of the problem or it doesn't matter?



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.