Linker error while adding Firebase SDK to QT project.
-
wrote on 18 Jun 2024, 08:33 last edited by
Hello,
I am need to firebase support for my qt project which is configured using qt5.15.
I followed all steps mentioned at firebase doc but I am getting below errors while building project.arm64-v8a/main.obj: In function
initializeFirebaseApp()': E:\Drone/EshmaGCS\src\main.cc:245: undefined reference to
firebase::App::Create(firebase::AppOptions const&, _JNIEnv*, _jobject*)'
E:\Drone/EshmaGCS\src\main.cc:253: undefined reference tofirebase::auth::Auth::GetAuth(firebase::App*, firebase::InitResult*)' E:\Drone/EshmaGCS\src\main.cc:261: undefined reference to
firebase::SetLogLevel(firebase::LogLevel)'
arm64-v8a/main.obj: In functionsignInWithGoogle(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)': E:\Drone/EshmaGCS\src\main.cc:275: undefined reference to
firebase::auth::Auth::GetAuth(firebase::App*, firebase::InitResult*)'
E:\Drone/EshmaGCS\src\main.cc:277: undefined reference tofirebase::auth::GoogleAuthProvider::GetCredential(char const*, char const*)' E:\Drone/EshmaGCS\src\main.cc:279: undefined reference to
firebase::auth::Auth::SignInAndRetrieveDataWithCredential(firebase::auth::Credential const&)'
arm64-v8a/main.obj: In functionMutexLock': E:\Drone/EshmaGCS\libs\Firebase\firebase_cpp_sdk\include\firebase\internal\mutex.h:85: undefined reference to
firebase::Mutex::Acquire()'
arm64-v8a/main.obj: In function `~MutexLock':Can anyone help me to resolve the same?
Thanks and Regards,
Vidya Patil -
Are the Firebase libs for arm64-v8a?
How exactly did you add them (your pri or CMakeLists.txt file). -
wrote on 18 Jun 2024, 09:34 last edited by
I added it in .pri file
-
@Vidya485 I can't see the content of the pri file.
Please post it as text.And please also answer my first question.
-
wrote on 18 Jun 2024, 09:47 last edited by
-
wrote on 18 Jun 2024, 10:28 last edited by
-
@JonB, I am not sure about it, I am new to qt framework. I might be wrong but in qt5.15 I can see multi abi kit so I thought I might need to libraries from multiple architectures.
@Vidya485 Remove all other architectures except the one you're trying right now - does it work?
How and where is ANDROID_EXTRA_LIBS used?
You can also check the build logs to see whether the libs are actualy linked.And again: why do you post text as pictures?
-
Hi,
ANDROID_EXTRA_LIBS
is for deploying additional libraries to the target. It has nothing to do with linking. Use theLIBS
variable to setup proper linking. -
wrote on 20 Jun 2024, 04:43 last edited by
Thank you all for your quick response and help. All linker errors are gone now and I could build apk. But my app is crashing when I open it.
Does qt5.15 supports latest firebase sdk i..e firebase_cpp_sdk_12.0.0 ?
-
Did you debug your app to see where and why it is crashing?
-
wrote on 20 Jun 2024, 05:41 last edited by
I tired app on two different android version
on Android 14 error was
AndroidRuntime: FATAL EXCEPTION: main
06-19 09:39:59.417 24868 24868 E AndroidRuntime: Process: org.eshma.eshmagcs, PID: 24868
06-19 09:39:59.417 24868 24868 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.eshma.eshmagcs/org.eshma.eshmagcs.QGCActivity}: java.lang.IllegalArgumentException: org.eshma.eshmagcs: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
06-19 09:39:59.417 24868 24868 E AndroidRuntime: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.On Android 8 error was
ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=org.eshma.eshmagcs cmp=org.eshma.eshmagcs/.QGCActivity} from uid 10020
06-19 21:28:39.946 1345 2512 I ActivityManager: Start proc 7951:org.eshma.eshmagcs/u0a90 for activity org.eshma.eshmagcs/.QGCActivity
--------- beginning of crash
06-19 21:28:40.184 7951 7951 E AndroidRuntime: FATAL EXCEPTION: main
06-19 21:28:40.184 7951 7951 E AndroidRuntime: Process: org.eshma.eshmagcs, PID: 7951
06-19 21:28:40.184 7951 7951 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.eshma.eshmagcs/org.eshma.eshmagcs.QGCActivity}: java.lang.ClassNotFoundException: Didn't find class "org.eshma.eshmagcs.QGCActivity" on path: DexPathList[[zip file "/data/app/org.eshma.eshmagcs-P35fhwEYV0p61_KgFP-IRQ==/base.apk"],nativeLibraryDirectories=[/data/app/org.eshma.eshmagcs-P35fhwEYV0p61_KgFP-IRQ==/lib/arm64, /data/app/org.eshma.eshmagcs-P35fhwEYV0p61_KgFP-IRQ==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2682)
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2859)
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at android.app.ActivityThread.-wrap11(Unknown Source:0)
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1592)
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6518)
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
06-19 21:28:40.184 7951 7951 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) -
This looks like the crashes are not related to the Firebase. Check whether your app also crashes if you remove Firebase libs completely.
-
wrote on 20 Jun 2024, 05:59 last edited by
App was working fine till I add firebase libs and made changes related to firebase like adding build.gradle and all.
-
Why not using the Qt InterBase sql plugin instead trying to directly link to the firebird libs?
-
wrote on 20 Jun 2024, 07:07 last edited by
I am new to Qt framework itself, what I am trying to achieve is
- I have have customized QGroundcontrol GCS https://github.com/mavlink/qgroundcontrol
- I want to add firebase support with- Google login
- Want to get drone live location on fleet management app ( which is using firebase) for which GCSs will be sending data to firebase.
I am not sure if Qt InterBase sql plugin will be able to achieve this.
Any guidance and help would be greatly appreciated.
1/17