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. QTAndroid protobuf with QT creator
Forum Updated to NodeBB v4.3 + New Features

QTAndroid protobuf with QT creator

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
20 Posts 3 Posters 2.7k Views 3 Watching
  • 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.
  • A Offline
    A Offline
    AMOL
    wrote on last edited by AMOL
    #11

    Ok but issue then issue is after creating my pb.cc and pb.h file and added to qt creator is gives error as undefined reference to Google protobuf
    Then can anyone provide steps for adding protobuf .so files and pb.cc pb.h files to qt creator and then run on Android

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #12

      Did you add the

      LIBS += 
      

      statement in your .pro file to link to the library ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AMOL
        wrote on last edited by
        #13

        @sgaist said in QTAndroid protobuf with QT creator:

        LIBS +=

        My proto file look like this:

        #-------------------------------------------------

        Project created by QtCreator 2016-03-22T07:38:29

        #-------------------------------------------------

        QT += core gui bluetooth
        CONFIG += c++11

        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

        TARGET = BLETester
        TEMPLATE = app

        SOURCES += main.cpp
        acp.pb.cc
        dfuservice.cpp
        mainwindow.cpp
        bleinterface.cpp
        utils.cpp

        HEADERS += mainwindow.h
        acp.pb.h
        bleinterface.h
        dfuservice.h
        lib-qt-qml-tricks/src/qqmlhelpers.h
        lib-qt-qml-tricks/src/qqmlhelpers.h
        utils.h

        FORMS += mainwindow.ui

        win32:INCLUDEPATH += "$$PWD\google"

        RESOURCES +=
        resources.qrc

        android{
        INCLUDEPATH += F:\QT_android\compile\protobuf-3.9.1\src
        LIBS += -L"F:\QT_android\compile\protobuf-3.9.1\src\protobuff_android"
        -lprotobuf
        -lprotobuf-lite
        -lprotoc
        }

        Turn off ALL warning for the project

        win32:CONFIG += warn_off

        contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
        ANDROID_EXTRA_LIBS =
        $$PWD/../protobuf_android/libprotobuf.so
        $$PWD/../protobuf_android/libprotobuf-lite.so
        $$PWD/../protobuf_android/libprotoc.so
        }

        DISTFILES +=
        acp.proto

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #14

          Are you sure you have built protobuf for the correct architecture ? 32 vs 64 bit for example ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AMOL
            wrote on last edited by
            #15

            @sgaist said in QTAndroid protobuf with QT creator:

            distribution

            @sgaist said in QTAndroid protobuf with QT creator:

            protoc just generate files in the programming language you choose. There's nothing special here, as I already suggested, install the protoc compiler from your distribution and generate the file with it.

            yes
            as you said, i have installed protobuf compiler on Linux 64 bit and from that only I am generating pb.cc and pb.h files

            Is that correct?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AMOL
              wrote on last edited by
              #16

              @SGaist any comment on this???

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AMOL
                wrote on last edited by AMOL
                #17

                After compiling from protobuf-cpp-3.9.1 and adding pb.cc and pb.h to project I get this error
                0_1567683866738_a8f75ad0-3bfc-4f60-bcb5-f433b61fe52f-image.png

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #18

                  Start by just building the protobuf related files so you ensure that you have that stuff working correctly. I would even start first by building for your desktop OS. That way you ensure that this part is working correctly before going forward with Android.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    AMOL
                    wrote on last edited by
                    #19

                    Yes, This application is hybrid application (ios,android and windows)
                    for windows desktop application protobuf is working correctly without error,
                    but when I change my kit to android then it gives above error

                    1 Reply Last reply
                    0
                    • A AMOL

                      I used protobuf but it is for Windows or Linux not for Android I want to cross compile it with Android then I can us it

                      Pablo J. RoginaP Offline
                      Pablo J. RoginaP Offline
                      Pablo J. Rogina
                      wrote on last edited by
                      #20

                      @amol said in QTAndroid protobuf with QT creator:

                      I used protobuf but it is for Windows or Linux

                      Ok, so you're somehow experienced with that technology.

                      For me that I'm not, could you please explain how to use protobuf in a general way, and I guess that in the process you might figure out what you're doing differently or not yet doing for Android?

                      In addition, when working with a 3rd party library or files that you want to use in a Qt application for Android the basic requirement is that the library is compiled for any of the Android platforms (usually arm6, arm7 and lately arm8) and that process is usually carried on separately from Qt Creator via the NDK (talking about a C++ library or files). Once you have the (shared) objects created with the NDK you place them in a proper location within the Qt project folder structure and then Qt Creator is finally able to create the Android app and deploy to the device configured in your kit.

                      So talking about protobuf it couldn't be that different. You need to create with NDK whatever components are required (either a .so or files .cc and .h) and then add such files to your Qt project

                      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

                      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