QTAndroid protobuf with QT creator
-
@amol said in QTAndroid protobuf with QT creator:
I want to cross compile it with Android then I can us it
From the issue you pointed before, have you check this comment? It says it succeeded, and it describes all the tool versions for its environment (Clang, NDK, Qt, etc.)
-
@pablo-j-rogina yes I used it but it's for clang I want for armabi-7
-
@amol said in QTAndroid protobuf with QT creator:
it's for clang I want for armabi-7
It looks you're mixing things up.
Clang is a compiler (tool) while armabi-7 is a processor architecture (platform)
A compiler creates an executable program for a particular platform.As you can see from that comment, Clang should allow you to build the required protobuf file(s) for your platform
-
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.
-
-
Did you add the
LIBS +=
statement in your .pro file to link to the library ?
-
@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++11greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = BLETester
TEMPLATE = appSOURCES += main.cpp
acp.pb.cc
dfuservice.cpp
mainwindow.cpp
bleinterface.cpp
utils.cppHEADERS += mainwindow.h
acp.pb.h
bleinterface.h
dfuservice.h
lib-qt-qml-tricks/src/qqmlhelpers.h
lib-qt-qml-tricks/src/qqmlhelpers.h
utils.hFORMS += mainwindow.ui
win32:INCLUDEPATH += "$$PWD\google"
RESOURCES +=
resources.qrcandroid{
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 -
Are you sure you have built protobuf for the correct architecture ? 32 vs 64 bit for example ?
-
@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 filesIs that correct?
-
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.
-
@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