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. FireBase and Qt6
Forum Updated to NodeBB v4.3 + New Features

FireBase and Qt6

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
27 Posts 4 Posters 3.5k Views 2 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.
  • J Joshika_Namani

    I'm trying to integrate Firebase in my Qt6 and Qt5 I have tried using firebasecppsdk to build Cloud Message Application, after including all directories and files in Qt .pro, still I'm unable to call:

        QAndroidJniEnvironment qjni;
        JNIEnv* jni_env = 0;
        JavaVM* javaVM = qjni.javaVM();
        jint res = javaVM->GetEnv((void**)&jni_env, JNI_VERSION_1_6);
        if (res != JNI_OK) {
            // Handle error - could not get JNIEnv
        }
        QAndroidJniObject activity = QtAndroid::androidActivity();
        firebase::App* app = ::firebase::App::Create(::firebase::AppOptions(), jni_env, activity.object<jobject>());
    
        firebase::messaging::Listener* listener = new MyMessageListener();
        firebase::messaging::Initialize(*app, listener);
    

    Errors:
    ``` undefined reference to firebase::messaging::Initialize(firebase::App const&, firebase::messaging::Listener*)' arm64-v8a/WebBoard.o: In function ~MyMessageListener':
    MessagingApplication/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../WebBoard.cpp:98: undefined reference to firebase::messaging::Listener::~Listener()' arm64-v8a/WebBoard.o: In function Listener':
    /MessagingApplication/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../firebase_cpp_sdk_12.2.0/firebase_cpp_sdk/include/firebase/messaging.h:(.text._ZN8firebase9messaging8ListenerC2Ev[_ZN8firebase9messaging8ListenerC2Ev]+0x4): undefined reference to vtable for firebase::messaging::Listener' /home/joshikanamani/Desktop/NewProjects/MessagingApplication/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../firebase_cpp_sdk_12.2.0/firebase_cpp_sdk/include/firebase/messaging.h:(.text._ZN8firebase9messaging8ListenerC2Ev[_ZN8firebase9messaging8ListenerC2Ev]+0x8): undefined reference to vtable for firebase::messaging::Listener'
    arm64-v8a/WebBoard.o:(.data+0x0): undefined reference to firebase::g_messaging_initializer' arm64-v8a/WebBoard.o:(.data.rel.ro+0x40): undefined reference to typeinfo for firebase::messaging::Listener'
    arm64-v8a/moc_WebBoard.o:(.data+0x0): undefined reference to `firebase::g_messaging_initializer'

    
    .pro:
    

    Define the path to your Firebase C++ SDK
    FIREBASE_CPP_SDK_DIR = $$PWD/firebase_cpp_sdk_12.2.0/firebase_cpp_sdk

    Pass the path as a system property for Gradle

    QMAKE_MACRO += -Dfirebase_cpp_sdk.dir=$$FIREBASE_CPP_SDK_DI

    Include Firebase SDK include path

    INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/include

    Add the Firebase libraries

    LIBS += -L$$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a
    -lfirebase_app
    -lfirebase_analytics
    -lfirebase_auth
    -lfirebase_database
    -lfirebase_messaging \

    INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_app.a
    INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_messaging.a

    Thanks in advance
    jsulmJ Online
    jsulmJ Online
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @Joshika_Namani said in FireBase and Qt6:

    undefined reference to firebase::messaging::Initialize(firebase::App const&, firebase::messaging::Listener*)' arm64-v8a/WebBoard.o: In function ~MyMessageListener':

    Is this the very first error? Are there any other errors or warning (like incompatible library, library not found)?

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

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Joshika_Namani
      wrote on last edited by
      #3

      @jsulm
      Getting below error

      Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
      > Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache [in thread "Daemon worker"]
      

      tried with Qtfirebase also getting below error:

      make: *** No rule to make target 'MessageApp_version2/firebase_cpp_sdk/libs/android/arm64-v8a/libfirebase_app.a', needed by 'libMessageApp_version3_arm64-v8a.so'.  Stop.
      
      1 Reply Last reply
      0
      • J Joshika_Namani

        I'm trying to integrate Firebase in my Qt6 and Qt5 I have tried using firebasecppsdk to build Cloud Message Application, after including all directories and files in Qt .pro, still I'm unable to call:

            QAndroidJniEnvironment qjni;
            JNIEnv* jni_env = 0;
            JavaVM* javaVM = qjni.javaVM();
            jint res = javaVM->GetEnv((void**)&jni_env, JNI_VERSION_1_6);
            if (res != JNI_OK) {
                // Handle error - could not get JNIEnv
            }
            QAndroidJniObject activity = QtAndroid::androidActivity();
            firebase::App* app = ::firebase::App::Create(::firebase::AppOptions(), jni_env, activity.object<jobject>());
        
            firebase::messaging::Listener* listener = new MyMessageListener();
            firebase::messaging::Initialize(*app, listener);
        

        Errors:
        ``` undefined reference to firebase::messaging::Initialize(firebase::App const&, firebase::messaging::Listener*)' arm64-v8a/WebBoard.o: In function ~MyMessageListener':
        MessagingApplication/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../WebBoard.cpp:98: undefined reference to firebase::messaging::Listener::~Listener()' arm64-v8a/WebBoard.o: In function Listener':
        /MessagingApplication/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../firebase_cpp_sdk_12.2.0/firebase_cpp_sdk/include/firebase/messaging.h:(.text._ZN8firebase9messaging8ListenerC2Ev[_ZN8firebase9messaging8ListenerC2Ev]+0x4): undefined reference to vtable for firebase::messaging::Listener' /home/joshikanamani/Desktop/NewProjects/MessagingApplication/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../firebase_cpp_sdk_12.2.0/firebase_cpp_sdk/include/firebase/messaging.h:(.text._ZN8firebase9messaging8ListenerC2Ev[_ZN8firebase9messaging8ListenerC2Ev]+0x8): undefined reference to vtable for firebase::messaging::Listener'
        arm64-v8a/WebBoard.o:(.data+0x0): undefined reference to firebase::g_messaging_initializer' arm64-v8a/WebBoard.o:(.data.rel.ro+0x40): undefined reference to typeinfo for firebase::messaging::Listener'
        arm64-v8a/moc_WebBoard.o:(.data+0x0): undefined reference to `firebase::g_messaging_initializer'

        
        .pro:
        

        Define the path to your Firebase C++ SDK
        FIREBASE_CPP_SDK_DIR = $$PWD/firebase_cpp_sdk_12.2.0/firebase_cpp_sdk

        Pass the path as a system property for Gradle

        QMAKE_MACRO += -Dfirebase_cpp_sdk.dir=$$FIREBASE_CPP_SDK_DI

        Include Firebase SDK include path

        INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/include

        Add the Firebase libraries

        LIBS += -L$$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a
        -lfirebase_app
        -lfirebase_analytics
        -lfirebase_auth
        -lfirebase_database
        -lfirebase_messaging \

        INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_app.a
        INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_messaging.a

        Thanks in advance
        jsulmJ Online
        jsulmJ Online
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #4

        @Joshika_Namani said in FireBase and Qt6:

        INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_app.a
        INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_messaging.a

        What is this? INCLUDEPATH is used to specify directories containing header files.

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

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Joshika_Namani
          wrote on last edited by Joshika_Namani
          #5

          @jsulm
          After including all files getting below error:

          arm64-v8a/main.o:(.data+0x0): undefined reference to `firebase::g_messaging_initializer'
          clang++: error: linker command failed with exit code 1 (use -v to see invocation)
          make: *** [Makefile:270: libMessageApp_Version1_arm64-v8a.so] Error 1
          
          jsulmJ 1 Reply Last reply
          0
          • J Joshika_Namani

            @jsulm
            After including all files getting below error:

            arm64-v8a/main.o:(.data+0x0): undefined reference to `firebase::g_messaging_initializer'
            clang++: error: linker command failed with exit code 1 (use -v to see invocation)
            make: *** [Makefile:270: libMessageApp_Version1_arm64-v8a.so] Error 1
            
            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @Joshika_Namani Please post you current pro file (the whole file) and the whole build log.

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

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Joshika_Namani
              wrote on last edited by
              #7
              
              QT += androidextras
              
              INCLUDEPATH = $$PWD/firebase_cpp_sdk/include/firebase/app.h
              
              INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_app.a
              INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_messaging.a
              
              QMAKE_INCDIR += android/app/build/intermediates/cmake/debug/obj/arm64-v8a/include
              
              QMAKE_INCDIR += android/app/build/intermediates/cmake/debug/obj/armeabi-v7a/include
              
              # LIBS += -L$$PWD/firebase_cpp_sdk/libs/android/arm64-v8a \
              #         -lfirebase_app \
              #         -lfirebase_messaging
              
              
              jsulmJ 1 Reply Last reply
              0
              • J Offline
                J Offline
                Joshika_Namani
                wrote on last edited by
                #8

                @jsulm below is my Build log:

                Screenshot from 2024-09-24 11-22-17.png

                1 Reply Last reply
                0
                • J Joshika_Namani
                  
                  QT += androidextras
                  
                  INCLUDEPATH = $$PWD/firebase_cpp_sdk/include/firebase/app.h
                  
                  INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_app.a
                  INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_messaging.a
                  
                  QMAKE_INCDIR += android/app/build/intermediates/cmake/debug/obj/arm64-v8a/include
                  
                  QMAKE_INCDIR += android/app/build/intermediates/cmake/debug/obj/armeabi-v7a/include
                  
                  # LIBS += -L$$PWD/firebase_cpp_sdk/libs/android/arm64-v8a \
                  #         -lfirebase_app \
                  #         -lfirebase_messaging
                  
                  
                  jsulmJ Online
                  jsulmJ Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  @Joshika_Namani said in FireBase and Qt6:

                  INCLUDEPATH = $$PWD/firebase_cpp_sdk/include/firebase/app.h

                  INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_app.a
                  INCLUDEPATH += $$FIREBASE_CPP_SDK_DIR/libs/android/arm64-v8a/libfirebase_messaging.a

                  This is still wrong... Please fix your pro file first. And post WHOLE pro file, not just part of it.

                  The first error message you get is quite clear - fix your code.

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

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    Joshika_Namani
                    wrote on last edited by
                    #10
                    QT += quick core
                    
                    # You can make your code fail to compile if it uses deprecated APIs.
                    # In order to do so, uncomment the following line.
                    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                    
                    SOURCES += \
                            main.cpp
                    
                    RESOURCES += qml.qrc
                    QT += androidextras
                    
                    INCLUDEPATH = $$PWD/firebase_cpp_sdk/include/
                    INCLUDEPATH = $$PWD/firebase_cpp_sdk/libs/
                    
                    QMAKE_INCDIR += android/app/build/intermediates/cmake/debug/obj/arm64-v8a/include
                    
                    QMAKE_INCDIR += android/app/build/intermediates/cmake/debug/obj/armeabi-v7a/include
                    
                    # LIBS += -L$$PWD/firebase_cpp_sdk/libs/android/arm64-v8a \
                    #         -lfirebase_app \
                    #         -lfirebase_messaging
                    
                    # Additional import path used to resolve QML modules in Qt Creator's code model
                    QML_IMPORT_PATH =
                    
                    # Additional import path used to resolve QML modules just for Qt Quick Designer
                    QML_DESIGNER_IMPORT_PATH =
                    
                    # Default rules for deployment.
                    qnx: target.path = /tmp/$${TARGET}/bin
                    else: unix:!android: target.path = /opt/$${TARGET}/bin
                    !isEmpty(target.path): INSTALLS += target
                    
                    DISTFILES += \
                        android/AndroidManifest.xml \
                        android/build.gradle \
                        android/gradle.properties \
                        android/gradle/wrapper/gradle-wrapper.jar \
                        android/gradle/wrapper/gradle-wrapper.properties \
                        android/gradlew \
                        android/gradlew.bat \
                        android/res/values/libs.xml
                    
                    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
                    
                    jsulmJ 1 Reply Last reply
                    0
                    • J Joshika_Namani
                      QT += quick core
                      
                      # You can make your code fail to compile if it uses deprecated APIs.
                      # In order to do so, uncomment the following line.
                      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                      
                      SOURCES += \
                              main.cpp
                      
                      RESOURCES += qml.qrc
                      QT += androidextras
                      
                      INCLUDEPATH = $$PWD/firebase_cpp_sdk/include/
                      INCLUDEPATH = $$PWD/firebase_cpp_sdk/libs/
                      
                      QMAKE_INCDIR += android/app/build/intermediates/cmake/debug/obj/arm64-v8a/include
                      
                      QMAKE_INCDIR += android/app/build/intermediates/cmake/debug/obj/armeabi-v7a/include
                      
                      # LIBS += -L$$PWD/firebase_cpp_sdk/libs/android/arm64-v8a \
                      #         -lfirebase_app \
                      #         -lfirebase_messaging
                      
                      # Additional import path used to resolve QML modules in Qt Creator's code model
                      QML_IMPORT_PATH =
                      
                      # Additional import path used to resolve QML modules just for Qt Quick Designer
                      QML_DESIGNER_IMPORT_PATH =
                      
                      # Default rules for deployment.
                      qnx: target.path = /tmp/$${TARGET}/bin
                      else: unix:!android: target.path = /opt/$${TARGET}/bin
                      !isEmpty(target.path): INSTALLS += target
                      
                      DISTFILES += \
                          android/AndroidManifest.xml \
                          android/build.gradle \
                          android/gradle.properties \
                          android/gradle/wrapper/gradle-wrapper.jar \
                          android/gradle/wrapper/gradle-wrapper.properties \
                          android/gradlew \
                          android/gradlew.bat \
                          android/res/values/libs.xml
                      
                      ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
                      
                      jsulmJ Online
                      jsulmJ Online
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by jsulm
                      #11

                      @Joshika_Namani said in FireBase and Qt6:
                      # LIBS += -L$$PWD/firebase_cpp_sdk/libs/android/arm64-v8a
                      # -lfirebase_app
                      # -lfirebase_messaging

                      Why did you comment this out?
                      Did you fix the code?

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

                      J 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Joshika_Namani said in FireBase and Qt6:
                        # LIBS += -L$$PWD/firebase_cpp_sdk/libs/android/arm64-v8a
                        # -lfirebase_app
                        # -lfirebase_messaging

                        Why did you comment this out?
                        Did you fix the code?

                        J Offline
                        J Offline
                        Joshika_Namani
                        wrote on last edited by
                        #12

                        @jsulm That part of code fave undefined error, so I have commented that,
                        first error: there are three create functions , but for android we have to call

                        static App* Create(JNIEnv* jni_env, jobject activity);
                        

                        below app.h code:

                        #if !FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                          /// @brief Initializes the default firebase::App with default options.
                          ///
                          /// @note This method is specific to non-Android implementations.
                          ///
                          /// @return New App instance, the App should not be destroyed for the
                          /// lifetime of the application.  If default options can't be loaded this
                          /// will return null.
                          static App* Create();
                        #endif  // !FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                        
                        #ifndef SWIG
                        // <SWIG>
                        // For Unity, we actually use the simpler, iOS version for both platforms
                        // </SWIG>
                        #if FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                          /// @brief Initializes the default firebase::App with default options.
                          ///
                          /// @note This method is specific to the Android implementation.
                          ///
                          /// @param[in] jni_env JNI environment required to allow Firebase services
                          /// to interact with the Android framework.
                          /// @param[in] activity JNI reference to the Android activity, required to
                          /// allow Firebase services to interact with the Android application.
                          ///
                          /// @return New App instance. The App should not be destroyed for the
                          /// lifetime of the application.  If default options can't be loaded this
                          /// will return null.
                          static App* Create(JNIEnv* jni_env, jobject activity);
                        #endif  // FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                        #endif  // SWIG
                        
                        #if !FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                          /// @brief Initializes the default firebase::App with the given options.
                          ///
                          /// @note This method is specific to non-Android implementations.
                          ///
                          /// Options are copied at initialization time, so changes to the object are
                          /// ignored.
                          /// @param[in] options Options that control the creation of the App.
                          ///
                          /// @return New App instance, the App should not be destroyed for the
                          /// lifetime of the application.
                          static App* Create(const AppOptions& options);
                        

                        My code:

                        firebase::App* app = firebase::App::Create();
                        

                        Error:

                        27: undefined reference to `firebase::App::Create()'
                        
                        jsulmJ 1 Reply Last reply
                        0
                        • J Joshika_Namani

                          @jsulm That part of code fave undefined error, so I have commented that,
                          first error: there are three create functions , but for android we have to call

                          static App* Create(JNIEnv* jni_env, jobject activity);
                          

                          below app.h code:

                          #if !FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                            /// @brief Initializes the default firebase::App with default options.
                            ///
                            /// @note This method is specific to non-Android implementations.
                            ///
                            /// @return New App instance, the App should not be destroyed for the
                            /// lifetime of the application.  If default options can't be loaded this
                            /// will return null.
                            static App* Create();
                          #endif  // !FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                          
                          #ifndef SWIG
                          // <SWIG>
                          // For Unity, we actually use the simpler, iOS version for both platforms
                          // </SWIG>
                          #if FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                            /// @brief Initializes the default firebase::App with default options.
                            ///
                            /// @note This method is specific to the Android implementation.
                            ///
                            /// @param[in] jni_env JNI environment required to allow Firebase services
                            /// to interact with the Android framework.
                            /// @param[in] activity JNI reference to the Android activity, required to
                            /// allow Firebase services to interact with the Android application.
                            ///
                            /// @return New App instance. The App should not be destroyed for the
                            /// lifetime of the application.  If default options can't be loaded this
                            /// will return null.
                            static App* Create(JNIEnv* jni_env, jobject activity);
                          #endif  // FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                          #endif  // SWIG
                          
                          #if !FIREBASE_PLATFORM_ANDROID || defined(DOXYGEN)
                            /// @brief Initializes the default firebase::App with the given options.
                            ///
                            /// @note This method is specific to non-Android implementations.
                            ///
                            /// Options are copied at initialization time, so changes to the object are
                            /// ignored.
                            /// @param[in] options Options that control the creation of the App.
                            ///
                            /// @return New App instance, the App should not be destroyed for the
                            /// lifetime of the application.
                            static App* Create(const AppOptions& options);
                          

                          My code:

                          firebase::App* app = firebase::App::Create();
                          

                          Error:

                          27: undefined reference to `firebase::App::Create()'
                          
                          jsulmJ Online
                          jsulmJ Online
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          @Joshika_Namani said in FireBase and Qt6:

                          That part of code fave undefined error, so I have commented that

                          So, you think you can use these libraries without linking?
                          You have to link these libraries. If you get "undefined error" then you have to check whether these libraries are compatible with the architecture you're using (arm64-v8a). Please link this libraries and post whole build log if the build fails.

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

                          J 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @Joshika_Namani said in FireBase and Qt6:

                            That part of code fave undefined error, so I have commented that

                            So, you think you can use these libraries without linking?
                            You have to link these libraries. If you get "undefined error" then you have to check whether these libraries are compatible with the architecture you're using (arm64-v8a). Please link this libraries and post whole build log if the build fails.

                            J Offline
                            J Offline
                            Joshika_Namani
                            wrote on last edited by
                            #14

                            @jsulm

                            I'm not sure which Create function I should call.

                            I am getting a lot of errors. Below are some of the errors:

                            Screenshot from 2024-09-24 13-44-58.png

                            jsulmJ 1 Reply Last reply
                            0
                            • J Joshika_Namani

                              @jsulm

                              I'm not sure which Create function I should call.

                              I am getting a lot of errors. Below are some of the errors:

                              Screenshot from 2024-09-24 13-44-58.png

                              jsulmJ Online
                              jsulmJ Online
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #15

                              @Joshika_Namani I wrote before:
                              "f you get "undefined error" then you have to check whether these libraries are compatible with the architecture you're using (arm64-v8a)"

                              And:
                              "post whole build log if the build fails"

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

                              J 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @Joshika_Namani I wrote before:
                                "f you get "undefined error" then you have to check whether these libraries are compatible with the architecture you're using (arm64-v8a)"

                                And:
                                "post whole build log if the build fails"

                                J Offline
                                J Offline
                                Joshika_Namani
                                wrote on last edited by
                                #16

                                @jsulm

                                I have now included those required libraries, and there are no longer any errors related to those libraries.
                                The issue right now is with the code.

                                Screenshot from 2024-09-24 14-35-49.png
                                recent build log image is related to this code(before your reply)

                                jsulmJ 1 Reply Last reply
                                0
                                • J Joshika_Namani

                                  @jsulm

                                  I have now included those required libraries, and there are no longer any errors related to those libraries.
                                  The issue right now is with the code.

                                  Screenshot from 2024-09-24 14-35-49.png
                                  recent build log image is related to this code(before your reply)

                                  jsulmJ Online
                                  jsulmJ Online
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #17

                                  @Joshika_Namani Please post the error message you get now

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

                                  J 1 Reply Last reply
                                  1
                                  • jsulmJ jsulm

                                    @Joshika_Namani Please post the error message you get now

                                    J Offline
                                    J Offline
                                    Joshika_Namani
                                    wrote on last edited by
                                    #18

                                    @jsulm

                                    After modifying code:

                                    static struct android_app* g_app_state = nullptr;
                                    // Get the activity.
                                    jobject GetActivity() { return g_app_state->activity->clazz; }
                                    JNIEnv* GetJniEnv() {
                                        JavaVM* vm = g_app_state->activity->vm;
                                        JNIEnv* env;
                                        jint result = vm->AttachCurrentThread(&env, nullptr);
                                        return result == JNI_OK ? env : nullptr;
                                    }
                                    void intialize(){
                                        ::firebase::App* app;
                                        ::firebase::messaging::PollableListener listener;
                                    
                                    #if ANDROID
                                        app = ::firebase::App::Create(GetJniEnv(), GetActivity());
                                    #else
                                        app = ::firebase::App::Create();
                                    #endif
                                    
                                    

                                    getting below erros:

                                    ../../main.cpp:52:11: error: no matching function for call to 'Create'
                                        app = ::firebase::App::Create(GetJniEnv(), GetActivity());
                                              ^~~~~~~~~~~~~~~~~~~~~~~
                                    ../../../MessageApp_Version1/firebase_cpp_sdk/include/firebase/app.h:538:15: note: candidate function not viable: no known conversion from 'JNIEnv *' (aka '_JNIEnv *') to 'const firebase::AppOptions' for 1st argument
                                      static App* Create(const AppOptions& options, const char* name);
                                                  ^
                                    ../../../MessageApp_Version1/firebase_cpp_sdk/include/firebase/app.h:497:15: note: candidate function not viable: requires single argument 'options', but 2 arguments were provided
                                      static App* Create(const AppOptions& options);
                                                  ^
                                    ../../../MessageApp_Version1/firebase_cpp_sdk/include/firebase/app.h:462:15: note: candidate function not viable: requires 0 arguments, but 2 were provided
                                      static App* Create();
                                                  ^
                                    1 error generated.
                                    make: *** [Makefile:466: arm64-v8a/main.o] Error 1
                                    14:55:32: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited with code 2.
                                    Error while building/deploying project MessageApp_Version1 (kit: Android Qt 5.15.2 Clang Multi-Abi)
                                    When executing step "Make"
                                    

                                    for previous code I got around 444 errors.

                                    jsulmJ 1 Reply Last reply
                                    0
                                    • J Joshika_Namani

                                      @jsulm

                                      After modifying code:

                                      static struct android_app* g_app_state = nullptr;
                                      // Get the activity.
                                      jobject GetActivity() { return g_app_state->activity->clazz; }
                                      JNIEnv* GetJniEnv() {
                                          JavaVM* vm = g_app_state->activity->vm;
                                          JNIEnv* env;
                                          jint result = vm->AttachCurrentThread(&env, nullptr);
                                          return result == JNI_OK ? env : nullptr;
                                      }
                                      void intialize(){
                                          ::firebase::App* app;
                                          ::firebase::messaging::PollableListener listener;
                                      
                                      #if ANDROID
                                          app = ::firebase::App::Create(GetJniEnv(), GetActivity());
                                      #else
                                          app = ::firebase::App::Create();
                                      #endif
                                      
                                      

                                      getting below erros:

                                      ../../main.cpp:52:11: error: no matching function for call to 'Create'
                                          app = ::firebase::App::Create(GetJniEnv(), GetActivity());
                                                ^~~~~~~~~~~~~~~~~~~~~~~
                                      ../../../MessageApp_Version1/firebase_cpp_sdk/include/firebase/app.h:538:15: note: candidate function not viable: no known conversion from 'JNIEnv *' (aka '_JNIEnv *') to 'const firebase::AppOptions' for 1st argument
                                        static App* Create(const AppOptions& options, const char* name);
                                                    ^
                                      ../../../MessageApp_Version1/firebase_cpp_sdk/include/firebase/app.h:497:15: note: candidate function not viable: requires single argument 'options', but 2 arguments were provided
                                        static App* Create(const AppOptions& options);
                                                    ^
                                      ../../../MessageApp_Version1/firebase_cpp_sdk/include/firebase/app.h:462:15: note: candidate function not viable: requires 0 arguments, but 2 were provided
                                        static App* Create();
                                                    ^
                                      1 error generated.
                                      make: *** [Makefile:466: arm64-v8a/main.o] Error 1
                                      14:55:32: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited with code 2.
                                      Error while building/deploying project MessageApp_Version1 (kit: Android Qt 5.15.2 Clang Multi-Abi)
                                      When executing step "Make"
                                      

                                      for previous code I got around 444 errors.

                                      jsulmJ Online
                                      jsulmJ Online
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #19

                                      @Joshika_Namani Isn't the error message quite clear? There is no ::firebase::App::Create overload which takes two parameters of these types. The error message also tells you which 3 overloads are there, use one of them.

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

                                      J 1 Reply Last reply
                                      1
                                      • jsulmJ jsulm

                                        @Joshika_Namani Isn't the error message quite clear? There is no ::firebase::App::Create overload which takes two parameters of these types. The error message also tells you which 3 overloads are there, use one of them.

                                        J Offline
                                        J Offline
                                        Joshika_Namani
                                        wrote on last edited by Joshika_Namani
                                        #20

                                        @jsulm

                                        I tried

                                        app = ::firebase::App::Create(app_options,"app");
                                        
                                        arm64-v8a/main.o: In function `intialize()':
                                                   /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../main.cpp:55: undefined reference to `firebase::App::Create(firebase::AppOptions const&, char const*)'
                                                   clang++: error: linker command failed with exit code 1 (use -v to see invocation)
                                                   make: *** [Makefile:273: libMessageApp_Version1_arm64-v8a.so] Error 1
                                                   15:17:22: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited with code 2.
                                                   Error while building/deploying project MessageApp_Version1 (kit: Android Qt 5.15.2 Clang Multi-Abi)           ^
                                        

                                        for below code:

                                            app = ::firebase::App::Create();
                                        
                                        arm64-v8a/main.o: In function `intialize()':
                                        /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../main.cpp:55: undefined reference to `firebase::App::Create()'
                                        clang++: error: linker command failed with exit code 1 (use -v to see invocation)
                                        make: *** [Makefile:273: libMessageApp_Version1_arm64-v8a.so] Error 1
                                        15:15:38: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited with code 2.
                                        Error while building/deploying project MessageApp_Version1 (kit: Android Qt 5.15.2 Clang Multi-Abi)
                                        When executing step "Make"
                                        

                                        app = ::firebase::App::Create(app_options);

                                        arm64-v8a/main.o: In function `intialize()':
                                        /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../main.cpp:55: undefined reference to `firebase::App::Create(firebase::AppOptions const&)'
                                        clang++: error: linker command failed with exit code 1 (use -v to see invocation)
                                        make: *** [Makefile:273: libMessageApp_Version1_arm64-v8a.so] Error 1
                                        15:18:04: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited with code 2.
                                        Error while building/deploying project MessageApp_Version1 (kit: Android Qt 5.15.2 Clang Multi-Abi)
                                        When executing step "Make"
                                        
                                        JonBJ jsulmJ 2 Replies Last reply
                                        0
                                        • J Joshika_Namani

                                          @jsulm

                                          I tried

                                          app = ::firebase::App::Create(app_options,"app");
                                          
                                          arm64-v8a/main.o: In function `intialize()':
                                                     /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../main.cpp:55: undefined reference to `firebase::App::Create(firebase::AppOptions const&, char const*)'
                                                     clang++: error: linker command failed with exit code 1 (use -v to see invocation)
                                                     make: *** [Makefile:273: libMessageApp_Version1_arm64-v8a.so] Error 1
                                                     15:17:22: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited with code 2.
                                                     Error while building/deploying project MessageApp_Version1 (kit: Android Qt 5.15.2 Clang Multi-Abi)           ^
                                          

                                          for below code:

                                              app = ::firebase::App::Create();
                                          
                                          arm64-v8a/main.o: In function `intialize()':
                                          /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../main.cpp:55: undefined reference to `firebase::App::Create()'
                                          clang++: error: linker command failed with exit code 1 (use -v to see invocation)
                                          make: *** [Makefile:273: libMessageApp_Version1_arm64-v8a.so] Error 1
                                          15:15:38: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited with code 2.
                                          Error while building/deploying project MessageApp_Version1 (kit: Android Qt 5.15.2 Clang Multi-Abi)
                                          When executing step "Make"
                                          

                                          app = ::firebase::App::Create(app_options);

                                          arm64-v8a/main.o: In function `intialize()':
                                          /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/../../main.cpp:55: undefined reference to `firebase::App::Create(firebase::AppOptions const&)'
                                          clang++: error: linker command failed with exit code 1 (use -v to see invocation)
                                          make: *** [Makefile:273: libMessageApp_Version1_arm64-v8a.so] Error 1
                                          15:18:04: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited with code 2.
                                          Error while building/deploying project MessageApp_Version1 (kit: Android Qt 5.15.2 Clang Multi-Abi)
                                          When executing step "Make"
                                          
                                          JonBJ Online
                                          JonBJ Online
                                          JonB
                                          wrote on last edited by
                                          #21

                                          @Joshika_Namani
                                          This seems to me to indicate that now your code is correct, the compiler finds the necessary matching functions in an included header file, but the link line does not include whatever you are supposed to have as a (legitimate) library (at least for that function) for FireBase apps to link against? But this is not my area, I know no more, just a suggestion.

                                          J 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