How to build MQTT for android devices?
-
Hi all,
I am devlop an app use MQTT protocol to communicate server.
First I build and run MQTT on desktop OK.
Then, I tried to build with android device, I got errors mqtt module is unknown. Then I tried to build mqtt for android as desktop way, but when I run program, It had error
So I just wonder how to build MQTT correctly for Android?Info:
- Qt: 5.13.0
- OS: Ubuntu 18.04
- Project target: Android x86
- NDK: r20
-
@quang-phu said in How to build MQTT for android devices?:
o I just wonder how to build MQTT correctly for Android?
I guess that you need to follow the same procedure you did for building the module for Desktop, this time using the compiler/tools from the NDK
-
Hi @Pablo-J-Rogina,
I tried again, built as the procedure of Desktop one, there is an error:
cannot find -lc++
and this was fixed by adding -nostdlib++ into .../Qt5.13.0/5.13.0/android_x86/mkspecs/android-clang/qmake.conf as
https://codereview.qt-project.org/c/qt/qtbase/+/264903/9/mkspecs/android-clang/qmake.conf#34
Then building was successful, and it works now. I will mark this issue be resolved.
Thank for your help :) -
@Pablo-J-Rogina Hello,
I have the same problem but I can't understand what to do to solve the error.
thank you for your answer -
@OSEMO-NDJUDI said in How to build MQTT for android devices?:
I have the same problem
That's a vague assertion.
Please show what you've done so far and the exact error message/condition that you've received. -
This post is deleted!
-
@Pablo-J-Rogina
when I run on the desktop, it works. But when I have errors when I run on Android -
@OSEMO-NDJUDI have you build Qt MQTT module for Android?
If so, have you properly referenced it in your .pro file? -
@Pablo-J-Rogina how to build the mqtt module on android
-
@OSEMO-NDJUDI have you checked the previous posts in this topic?
-
@Pablo-J-Rogina Yes.
you ask to follow the same procedure to create the module for Desktop, this time using the compiler / tools of the NDK.
But it's the end of the sentence that I can't understand. -
@OSEMO-NDJUDI You mean this: "If so, have you properly referenced it in your .pro file?"?
Please show your pro file, so we can check whether you properly added mqtt to your project. -
-
@OSEMO-NDJUDI Please post text, not screen-shots!
You use relative paths in your pro file: did you make sure they are correct? You can check compiler output to see what exact paths are passed to linker. -
unix:!macx: LIBS += -L$$PWD/../../../media/devqt/92DC-051C/qmqtt-master/build_armv8/lib -lQt5Qmqtt
INCLUDEPATH += $$PWD/../../../media/devqt/92DC-051C/qmqtt-master/src/mqtt
DEPENDPATH += $$PWD/../../../media/devqt/92DC-051C/qmqtt-master/src/mqtthow to chek the compiler output?
-
@OSEMO-NDJUDI said in How to build MQTT for android devices?:
how to chek the compiler output?
In QtCreator in one of the tabs at the bottom
-
@jsulm I erased the module mqt.
i am looking to install the module for android_armv8.
that i have this as an 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 /home/devqt/opt/QT13/5.13.2/android_arm64_v8a/mkspecs/android-clang/qmake.conf.
Error processing project file: ../qmqtt.pro -
I use mqtt5.13.0. By compiling mqtt5.13.0 to generate the corresponding desktop application library and Android library , the desktop application library I generated can run, but after the Android library is compiled, the Android running file runs on the mobile phone and crashes.
What shall I do?