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
    
    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 Offline
    jsulmJ Offline
    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 Offline
        jsulmJ Offline
        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 Offline
            jsulmJ Offline
            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 Offline
                jsulmJ Offline
                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 Offline
                    jsulmJ Offline
                    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 Offline
                        jsulmJ Offline
                        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 Offline
                            JonBJ Offline
                            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
                            • 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"
                              
                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by jsulm
                              #22

                              @Joshika_Namani For the third time now:
                              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"

                              Also: are there any other Firebase libraries besides the 3 you're linking?

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

                              1 Reply Last reply
                              0
                              • JonBJ JonB

                                @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 Offline
                                J Offline
                                Joshika_Namani
                                wrote on last edited by Joshika_Namani
                                #23

                                @jsulm
                                right now, I'm not facing that issue and those libraries are compatible with my architecture(arm64-v8a) and got solved, My issue is with create function example :

                                app = ::firebase::App::Create(app_options,"app");
                                
                                jsulmJ 1 Reply Last reply
                                0
                                • J Joshika_Namani

                                  @jsulm
                                  right now, I'm not facing that issue and those libraries are compatible with my architecture(arm64-v8a) and got solved, My issue is with create function example :

                                  app = ::firebase::App::Create(app_options,"app");
                                  
                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #24

                                  @Joshika_Namani said in FireBase and Qt6:

                                  My issue is with create function example :

                                  So, you mean the linker error (undefined reference to `firebase::App::Create(firebase::AppOptions const&, char const*)), right?
                                  That error clearly says that you have a problem with the shared libs.
                                  I asked you to post the whole build log so we can see whether there are any warnings from linker about incompatible libraries - you still did not post the whole log.
                                  I don't have anything to add...

                                  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:

                                    My issue is with create function example :

                                    So, you mean the linker error (undefined reference to `firebase::App::Create(firebase::AppOptions const&, char const*)), right?
                                    That error clearly says that you have a problem with the shared libs.
                                    I asked you to post the whole build log so we can see whether there are any warnings from linker about incompatible libraries - you still did not post the whole log.
                                    I don't have anything to add...

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

                                    @jsulm

                                    Below is my complete build log:

                                    19:59:59: Initializing deployment to Android device/simulator
                                    19:59:59: Deploying to d1d3484d
                                    19:59:59: Running steps for project MessageApp_Version1...
                                    19:59:59: Starting: "/home/joshikanamani/Qt/5.15.2/android/bin/qmake" /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/MessageApp_Version1.pro -spec android-clang CONFIG+=debug CONFIG+=qml_debug CONFIG+=force_debug_info CONFIG+=separate_debug_info ANDROID_ABIS=arm64-v8a
                                    19:59:59: The process "/home/joshikanamani/Qt/5.15.2/android/bin/qmake" exited normally.
                                    19:59:59: Starting: "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" -f /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/Makefile qmake_all
                                    make: Nothing to be done for 'qmake_all'.
                                    19:59:59: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited normally.
                                    19:59:59: Starting: "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" -j8
                                    /home/joshikanamani/Android/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -target aarch64-linux-android21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -g -Wall -W -D_REENTRANT -fPIC -D__ANDROID__ -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_ANDROIDEXTRAS_LIB -DQT_CORE_LIB -I../../../MessageApp_Version1 -I. -I../../firebase_cpp_sdk/include -I/libs/ -I/home/joshikanamani/Android/ndk/21.3.6528147/sources/android/native_app_glue//sources/android/native_app_glue -I/home/joshikanamani/Qt/5.15.2/android/include -I/home/joshikanamani/Qt/5.15.2/android/include/QtQuick -I/home/joshikanamani/Qt/5.15.2/android/include/QtGui -I/home/joshikanamani/Qt/5.15.2/android/include/QtQmlModels -I/home/joshikanamani/Qt/5.15.2/android/include/QtQml -I/home/joshikanamani/Qt/5.15.2/android/include/QtNetwork -I/home/joshikanamani/Qt/5.15.2/android/include/QtAndroidExtras -I/home/joshikanamani/Qt/5.15.2/android/include/QtCore -Iarm64-v8a -Iandroid/app/build/intermediates/cmake/debug/obj/arm64-v8a/include -Iandroid/app/build/intermediates/cmake/debug/obj/armeabi-v7a/include -I/home/joshikanamani/Qt/5.15.2/android/mkspecs/android-clang -o arm64-v8a/main.o ../../main.cpp
                                    ../../main.cpp:56:11: error: no matching function for call to 'Create'
                                        app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(), GetActivity());
                                              ^~~~~~~~~~~~~~~~~~~~~~~
                                    ../../firebase_cpp_sdk/include/firebase/app.h:538:15: note: candidate function not viable: requires 2 arguments, but 3 were provided
                                      static App* Create(const AppOptions& options, const char* name);
                                                  ^
                                    ../../firebase_cpp_sdk/include/firebase/app.h:497:15: note: candidate function not viable: requires single argument 'options', but 3 arguments were provided
                                      static App* Create(const AppOptions& options);
                                                  ^
                                    ../../firebase_cpp_sdk/include/firebase/app.h:462:15: note: candidate function not viable: requires 0 arguments, but 3 were provided
                                      static App* Create();
                                                  ^
                                    1 error generated.
                                    make: *** [Makefile:467: arm64-v8a/main.o] Error 1
                                    20:00:00: 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"
                                    20:00:00: Elapsed time: 00:01.
                                    
                                    
                                    Pl45m4P 1 Reply Last reply
                                    0
                                    • J Joshika_Namani

                                      @jsulm

                                      Below is my complete build log:

                                      19:59:59: Initializing deployment to Android device/simulator
                                      19:59:59: Deploying to d1d3484d
                                      19:59:59: Running steps for project MessageApp_Version1...
                                      19:59:59: Starting: "/home/joshikanamani/Qt/5.15.2/android/bin/qmake" /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/MessageApp_Version1.pro -spec android-clang CONFIG+=debug CONFIG+=qml_debug CONFIG+=force_debug_info CONFIG+=separate_debug_info ANDROID_ABIS=arm64-v8a
                                      19:59:59: The process "/home/joshikanamani/Qt/5.15.2/android/bin/qmake" exited normally.
                                      19:59:59: Starting: "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" -f /home/joshikanamani/Desktop/NewProjects/MessageApp_Version1/build/Android_Qt_5_15_2_Clang_Multi_Abi-Debug/Makefile qmake_all
                                      make: Nothing to be done for 'qmake_all'.
                                      19:59:59: The process "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" exited normally.
                                      19:59:59: Starting: "/home/joshikanamani/Android/ndk/21.3.6528147/prebuilt/linux-x86_64/bin/make" -j8
                                      /home/joshikanamani/Android/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -target aarch64-linux-android21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -g -Wall -W -D_REENTRANT -fPIC -D__ANDROID__ -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_ANDROIDEXTRAS_LIB -DQT_CORE_LIB -I../../../MessageApp_Version1 -I. -I../../firebase_cpp_sdk/include -I/libs/ -I/home/joshikanamani/Android/ndk/21.3.6528147/sources/android/native_app_glue//sources/android/native_app_glue -I/home/joshikanamani/Qt/5.15.2/android/include -I/home/joshikanamani/Qt/5.15.2/android/include/QtQuick -I/home/joshikanamani/Qt/5.15.2/android/include/QtGui -I/home/joshikanamani/Qt/5.15.2/android/include/QtQmlModels -I/home/joshikanamani/Qt/5.15.2/android/include/QtQml -I/home/joshikanamani/Qt/5.15.2/android/include/QtNetwork -I/home/joshikanamani/Qt/5.15.2/android/include/QtAndroidExtras -I/home/joshikanamani/Qt/5.15.2/android/include/QtCore -Iarm64-v8a -Iandroid/app/build/intermediates/cmake/debug/obj/arm64-v8a/include -Iandroid/app/build/intermediates/cmake/debug/obj/armeabi-v7a/include -I/home/joshikanamani/Qt/5.15.2/android/mkspecs/android-clang -o arm64-v8a/main.o ../../main.cpp
                                      ../../main.cpp:56:11: error: no matching function for call to 'Create'
                                          app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(), GetActivity());
                                                ^~~~~~~~~~~~~~~~~~~~~~~
                                      ../../firebase_cpp_sdk/include/firebase/app.h:538:15: note: candidate function not viable: requires 2 arguments, but 3 were provided
                                        static App* Create(const AppOptions& options, const char* name);
                                                    ^
                                      ../../firebase_cpp_sdk/include/firebase/app.h:497:15: note: candidate function not viable: requires single argument 'options', but 3 arguments were provided
                                        static App* Create(const AppOptions& options);
                                                    ^
                                      ../../firebase_cpp_sdk/include/firebase/app.h:462:15: note: candidate function not viable: requires 0 arguments, but 3 were provided
                                        static App* Create();
                                                    ^
                                      1 error generated.
                                      make: *** [Makefile:467: arm64-v8a/main.o] Error 1
                                      20:00:00: 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"
                                      20:00:00: Elapsed time: 00:01.
                                      
                                      
                                      Pl45m4P Offline
                                      Pl45m4P Offline
                                      Pl45m4
                                      wrote on last edited by Pl45m4
                                      #26

                                      @Joshika_Namani said in FireBase and Qt6:

                                      Below is my complete build log:

                                      I do not know more than @jsulm and @JonB , but this log does not match with what you are actually doing. It still shows the "old" error where you tried to call a non-existing c'tor.

                                      ../../main.cpp:56:11: error: no matching function for call to 'Create'
                                          app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(), GetActivity());
                                      

                                      So either you didn't saved your code file before building or you have multiple versions at the same time, or this is not the current error?!
                                      I mean, you want to have working code... we can only give an advice. The fixing has to be done by you.
                                      If you do the same - obviously not working - routines again and again... what do you expect? ;-)

                                      First, make sure that it links to Firebase correctly.
                                      Then use the API the right way...
                                      ...in case of any further errors, check where they occur and see what you can do to fix it again.


                                      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                                      ~E. W. Dijkstra

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

                                        After doing some research, I was able to integrate QtFirebase into my Qt Android application, but I am encountering the RunTime issue below. I have tried various solutions, but the issue still persists.

                                        I am encountering a runtime issue with my Android project using Qt and Firebase. Upon attempting to launch the app, it crashes with the following error:

                                        `W Zygote : Unable to open libbeluga.so: dlopen failed: library "libbeluga.so" not found.
                                        E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.croyance.messenger/com.croyance.messenger.Main}: java.lang.ClassNotFoundException: Didn't find class "com.croyance.messenger.Main" on path: DexPathList...

                                        The full logs can be found below. It seems that both the libbeluga.so native library and the Main activity are missing from the APK, which causes the application to fail at runtime. Additionally, there are several warnings related to Firebase initialization and some ANR (Application Not Responding) logs, which may be relevant.

                                        `W Zygote : Unable to open libbeluga.so: dlopen failed: library "libbeluga.so" not found.
                                        I libc : SetHeapTaggingLevel: tag level set to 0
                                        I yance.messenge: Late-enabling -Xcheck:jni
                                        I yance.messenge: Unquickening 21 vdex files!
                                        E yance.messenge: Unknown bits set in runtime_flags: 0x40000000
                                        E RefClass: java.lang.reflect.InvocationTargetException
                                        I OneTrace: Mark active for pid=25278? true
                                        
                                        E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.croyance.messenger.Main" on path: DexPathList[[zip file "/data/app/~~AaqN-4a0auFr8HV_MJwQ3g==/com.croyance.messenger-itiNKy_Da7NGfGLvDCWqRw==/base.apk"],nativeLibraryDirectories=[/data/app/~~AaqN-4a0auFr8HV_MJwQ3g==/com.croyance.messenger-itiNKy_Da7NGfGLvDCWqRw==/lib/arm64...
                                        

                                        I have correctly configured the AndroidManifest.xml file with the following activity declaration for Main:

                                        <activity 
                                            android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" 
                                            android:name=".Main" 
                                            android:label="FireBaseQTVersion1" 
                                            android:screenOrientation="unspecified" 
                                            android:launchMode="singleTop">
                                        </activity>
                                        

                                        I have followed the setup guidelines for Android in the QtFirebase documentation, specifically as outlined in the Setup.

                                        Environment:

                                        Qt Version: 5.15.2
                                        Firebase C++ SDK Version: 6.7.0
                                        Android NDK Version: 21.3.6528147
                                        Gradle Version: 5.6.4
                                        Operating System: Linux
                                        
                                        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