Unsolved Building Qt for Android platform from sources.
-
I am trying to cross compile openAuto for android platform. This c++ application is dependent on Qt libraries (multimedia, bluetooth, connectivity).
So, I started cross compiling Qt for android on Linux x86_64 host machine. But, I could not build the bluetooth and multimedia libraries with some features (pulse audio, gstreamer).
I am using NDK 16b toolchain. Android API level as 18.
I followed the below steps:git clone git://code.qt.io/qt/qt5.git qt5 cd qt5 perl init-repository --module-subset=qtbase,qtconnectivity,qtmultimedia,qtandroidextras
Are these 4 modules as input to init-repository are enough to build Qt libraries (multimedia, bluetooth, connectivity). Do I need to add any other?
./configure -opensource -confirm-license -android-arch armeabi -android-ndk-platform android-18 -xplatform android-g++ --disable-rpath -nomake tests -nomake examples -android-ndk /home/rthoomoju/Hithendra/NDK/android-ndk-r16b -android-sdk /home/rthoomoju/Android/Sdk -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 -skip qttranslations -skip qtserialport -no-warnings-are-errors -sysroot /home/rthoomoju/Hithendra/NDK/standalone_toolchain/sysroot -c++std c++14 -pulseaudio
Configure output is:
Qt Bluetooth:BlueZ .................................. no BlueZ Low Energy ....................... no Linux Crypto API ....................... no WinRT Bluetooth API (desktop & UWP) .... no
Qt Multimedia:
ALSA ................................... no GStreamer 1.0 .......................... no GStreamer 0.10 ......................... no Video for Linux ........................ yes OpenAL ................................. no PulseAudio ............................. no Resource Policy (libresourceqt5) ....... no Windows Audio Services ................. no DirectShow ............................. no Windows Media Foundation ............... no
Note: Also available for Linux: linux-clang linux-icc
ERROR: Feature 'pulseaudio' was enabled, but the pre-condition 'libs.pulseaudio' failed.
Why Qt bluetooth features are all No? Do I need to build any other dependent libraries for Android? Why enabling pulseaudio is giving the error? pulseaudio for Android need to be build separately? Please guide me ...
-
@Hithendra are you sure you need to build Qt for Android from sources yourself? I guess that installing a Qt for Linux release with Android support will provide the libraries required by the openAuto project directly. For instance, I installed Qt 5.9.0 for Linux x64 (qt-opensource-linux-x64-5.9.0.run) and checking the files installed, I can find libraries for Android already made:
pablo@lubuntu64:/opt/Qt5.9.0/5.9/android_armv7/lib$ file libQt5Multimedia.so libQt5Multimedia.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, not stripped
-
@Pablo-J-Rogina Thanks for the reply.
I thought building from the sources is the only way to get the qt libraries for android.
I will try the installation for linux with android support.Thanks alot ...
-
@Hithendra Simply use Qt online installer and select Qt for Android there...
-
@jsulm Thanks. I am trying that. Do I need to select source components also? I need mainly bluetooth and multimedia modules?
-
@Hithendra If you don't need Qt sources then there is no need to select source components. Bluetooth and multimedia are already part of normal Qt installation.
-
I got the required qt libraries. @jsulm @Pablo-J-Rogina Thanks .. You saved lot of my time.
-
@jsulm Is it possible to build Qt libraries for 64 bit arm v8?
I would like target for android nougat device.The issue I am facing when I tried to link the Qt5 libraries generated as mentioned by you (using Qt online installer) is link error as below:
/home/Qt_Nougat/5.11.0/android_armv7/lib/libQt5MultimediaWidgets.so: error adding symbols: File in wrong format.
Please help?
-
@Hithendra you mentioned before
Android API level as 18.
and also it looks like you installed latest Qt 5.11 with Android components
/home/Qt_Nougat/5.11.0/android_armv7/lib/
So is it working for such Android level 18?
-
@Hithendra Sure, you can build Qt. But it is no an easy task.
See https://wiki.qt.io/Building_Qt_5_from_Git
http://doc.qt.io/qt-5/build-sources.html -
@Pablo-J-Rogina I am able to successfully install that for API level 18.
Now, I am targeting API level 24 on 64 bit device. I tried to link the old libs for API level 24 onto 64 bit device. Then I got the error message while linking. -
@Hithendra Ok, so for using Qt's 32 bit libraries for Android (see my first post where it shows ELF 32-bit...) without recompiling the whole Qt platform for Android 64 bit this answer may shed some light...