Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved How to build MQTT for android devices?

    Mobile and Embedded
    5
    19
    1400
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Quang Phu
      Quang Phu last edited by Quang Phu

      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
      0_1567764801032_errors.png
      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
      Pablo J. Rogina 1 Reply Last reply Reply Quote 0
      • Pablo J. Rogina
        Pablo J. Rogina @Quang Phu last edited by

        @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

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        O 1 Reply Last reply Reply Quote 2
        • Quang Phu
          Quang Phu last edited by

          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 :)

          1 Reply Last reply Reply Quote 0
          • O
            OSEMO NDJUDI @Pablo J. Rogina last edited by

            @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

            Pablo J. Rogina 1 Reply Last reply Reply Quote 0
            • Pablo J. Rogina
              Pablo J. Rogina @OSEMO NDJUDI last edited by

              @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.

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              O 2 Replies Last reply Reply Quote 0
              • O
                OSEMO NDJUDI @Pablo J. Rogina last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • O
                  OSEMO NDJUDI @Pablo J. Rogina last edited by

                  @Pablo-J-Rogina erreur (2).png
                  when I run on the desktop, it works. But when I have errors when I run on Android

                  Pablo J. Rogina 1 Reply Last reply Reply Quote 0
                  • Pablo J. Rogina
                    Pablo J. Rogina @OSEMO NDJUDI last edited by

                    @OSEMO-NDJUDI have you build Qt MQTT module for Android?
                    If so, have you properly referenced it in your .pro file?

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    O 1 Reply Last reply Reply Quote 0
                    • O
                      OSEMO NDJUDI @Pablo J. Rogina last edited by

                      @Pablo-J-Rogina how to build the mqtt module on android

                      Pablo J. Rogina 1 Reply Last reply Reply Quote 0
                      • Pablo J. Rogina
                        Pablo J. Rogina @OSEMO NDJUDI last edited by

                        @OSEMO-NDJUDI have you checked the previous posts in this topic?

                        Upvote the answer(s) that helped you solve the issue
                        Use "Topic Tools" button to mark your post as Solved
                        Add screenshots via postimage.org
                        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                        O 1 Reply Last reply Reply Quote 0
                        • O
                          OSEMO NDJUDI @Pablo J. Rogina last edited by

                          @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.

                          jsulm 1 Reply Last reply Reply Quote 0
                          • jsulm
                            jsulm Lifetime Qt Champion @OSEMO NDJUDI last edited by

                            @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.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply Reply Quote 0
                            • O
                              OSEMO NDJUDI last edited by

                              erreur2.png

                              jsulm 1 Reply Last reply Reply Quote 0
                              • jsulm
                                jsulm Lifetime Qt Champion @OSEMO NDJUDI last edited by

                                @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.

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply Reply Quote 0
                                • O
                                  OSEMO NDJUDI last edited by

                                  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/mqtt

                                  how to chek the compiler output?

                                  jsulm 1 Reply Last reply Reply Quote 0
                                  • jsulm
                                    jsulm Lifetime Qt Champion @OSEMO NDJUDI last edited by

                                    @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

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    O 1 Reply Last reply Reply Quote 0
                                    • O
                                      OSEMO NDJUDI @jsulm last edited by

                                      @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

                                      1 Reply Last reply Reply Quote 0
                                      • X
                                        xtan last edited by

                                        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?

                                        1 Reply Last reply Reply Quote 0
                                        • X
                                          xtan last edited by

                                          b53b6be2-69fb-4c51-8872-44cf6074dfc1-image.png

                                          fc482740-301c-41e8-a461-575c288d0d4a-image.png

                                          fa216a63-92fd-49c3-8fcf-3115736539cb-image.png

                                          76376e0e-8a24-4fb9-9e32-93e413b92ec6-image.png

                                          The library has been generated, but the compiled Android application cannot be run

                                          f7efbaae-930c-4581-889e-7fcdc6fee30c-image.png

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post