Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to build MQTT for android devices?
QtWS25 Last Chance

How to build MQTT for android devices?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
19 Posts 5 Posters 2.6k Views
  • 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.
  • Q Offline
    Q Offline
    Quang Phu
    wrote on 6 Sept 2019, 10:14 last edited by Quang Phu 9 Jun 2019, 10:21
    #1

    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
    P 1 Reply Last reply 6 Sept 2019, 11:33
    0
    • Q Quang Phu
      6 Sept 2019, 10:14

      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
      P Offline
      P Offline
      Pablo J. Rogina
      wrote on 6 Sept 2019, 11:33 last edited by
      #2

      @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 4 Oct 2021, 13:11
      2
      • Q Offline
        Q Offline
        Quang Phu
        wrote on 8 Sept 2019, 12:13 last edited by
        #3

        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
        0
        • P Pablo J. Rogina
          6 Sept 2019, 11:33

          @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

          O Offline
          O Offline
          OSEMO NDJUDI
          wrote on 4 Oct 2021, 13:11 last edited by
          #4

          @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

          P 1 Reply Last reply 4 Oct 2021, 13:20
          0
          • O OSEMO NDJUDI
            4 Oct 2021, 13:11

            @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

            P Offline
            P Offline
            Pablo J. Rogina
            wrote on 4 Oct 2021, 13:20 last edited by
            #5

            @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 4 Oct 2021, 14:51
            0
            • P Pablo J. Rogina
              4 Oct 2021, 13:20

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

              O Offline
              O Offline
              OSEMO NDJUDI
              wrote on 4 Oct 2021, 14:51 last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • P Pablo J. Rogina
                4 Oct 2021, 13:20

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

                O Offline
                O Offline
                OSEMO NDJUDI
                wrote on 4 Oct 2021, 15:02 last edited by
                #7

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

                P 1 Reply Last reply 4 Oct 2021, 15:11
                0
                • O OSEMO NDJUDI
                  4 Oct 2021, 15:02

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

                  P Offline
                  P Offline
                  Pablo J. Rogina
                  wrote on 4 Oct 2021, 15:11 last edited by
                  #8

                  @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 4 Oct 2021, 15:42
                  0
                  • P Pablo J. Rogina
                    4 Oct 2021, 15:11

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

                    O Offline
                    O Offline
                    OSEMO NDJUDI
                    wrote on 4 Oct 2021, 15:42 last edited by
                    #9

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

                    P 1 Reply Last reply 4 Oct 2021, 16:00
                    0
                    • O OSEMO NDJUDI
                      4 Oct 2021, 15:42

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

                      P Offline
                      P Offline
                      Pablo J. Rogina
                      wrote on 4 Oct 2021, 16:00 last edited by
                      #10

                      @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 5 Oct 2021, 08:55
                      0
                      • P Pablo J. Rogina
                        4 Oct 2021, 16:00

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

                        O Offline
                        O Offline
                        OSEMO NDJUDI
                        wrote on 5 Oct 2021, 08:55 last edited by
                        #11

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

                        jsulmJ 1 Reply Last reply 5 Oct 2021, 09:02
                        0
                        • O OSEMO NDJUDI
                          5 Oct 2021, 08:55

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

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 5 Oct 2021, 09:02 last edited by
                          #12

                          @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
                          0
                          • O Offline
                            O Offline
                            OSEMO NDJUDI
                            wrote on 5 Oct 2021, 09:33 last edited by
                            #13

                            erreur2.png

                            jsulmJ 1 Reply Last reply 5 Oct 2021, 09:39
                            0
                            • O OSEMO NDJUDI
                              5 Oct 2021, 09:33

                              erreur2.png

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 5 Oct 2021, 09:39 last edited by
                              #14

                              @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
                              0
                              • O Offline
                                O Offline
                                OSEMO NDJUDI
                                wrote on 5 Oct 2021, 12:37 last edited by
                                #15

                                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?

                                jsulmJ 1 Reply Last reply 5 Oct 2021, 12:41
                                0
                                • O OSEMO NDJUDI
                                  5 Oct 2021, 12:37

                                  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?

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on 5 Oct 2021, 12:41 last edited by
                                  #16

                                  @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 5 Oct 2021, 13:42
                                  0
                                  • jsulmJ jsulm
                                    5 Oct 2021, 12:41

                                    @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

                                    O Offline
                                    O Offline
                                    OSEMO NDJUDI
                                    wrote on 5 Oct 2021, 13:42 last edited by
                                    #17

                                    @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
                                    0
                                    • X Offline
                                      X Offline
                                      xtan
                                      wrote on 21 Nov 2021, 03:35 last edited by
                                      #18

                                      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
                                      0
                                      • X Offline
                                        X Offline
                                        xtan
                                        wrote on 21 Nov 2021, 04:15 last edited by
                                        #19

                                        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
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved