Reputation: 1341
I'm trying to set up my Android project to report NDK crashes with Firebase Crashlytics SDK following the steps defined on Firebase Crashlytics NDK documentation . I tried reporting crashes with Firebase Crashlytics SDK (not the NDK library) by adding the following code and crashes are reported sucessfully.
releaseImplementation 'com.google.firebase:firebase-crashlytics:17.1.1'
The changes that I have applied are changing the library for the NDK one:
releaseImplementation 'com.google.firebase:firebase-crashlytics-ndk:17.2.1'
and adding the native symbol upload as the doc mentions into the app gradle file
buildTypes {
release {
firebaseCrashlytics {
nativeSymbolUploadEnabled true
}
}
}
The error I see on the logcat is:
2020-08-25 08:39:24.859 16889-16889/? I/CrashlyticsInitProvider: CrashlyticsInitProvider skipping initialization
2020-08-25 08:39:27.258 16889-16889/? I/CrashlyticsCore: Initializing Crashlytics Core 2.7.0.33
2020-08-25 08:39:36.980 17454-17454/? E/FirebaseCrashlytics: libcrashlytics could not be loaded. This APK may not have been compiled for this device's architecture. NDK crashes will not be reported to Crashlytics:
JNI_ERR returned from JNI_OnLoad in "/data/app/com.mypackagename==/lib/arm64/libcrashlytics.so"
2020-08-25 08:39:37.392 17454-17454/? I/FirebaseCrashlytics: Initializing Crashlytics 17.2.1
2020-08-25 08:39:37.762 17454-17498/? I/FirebaseCrashlytics: Crashlytics NDK initialization FAILED
2020-08-25 08:39:39.661 17530-17530/? E/FirebaseCrashlytics: libcrashlytics could not be loaded. This APK may not have been compiled for this device's architecture. NDK crashes will not be reported to Crashlytics:
JNI_ERR returned from JNI_OnLoad in "/data/app/com.mypackagename==/lib/arm64/libcrashlytics.so"
Before replacing the library for the NDK one I can force Java crash and the app crashes immediately, but when adding the NDK one, the app seems to hang (like and ANR) and not crashing immediately (probably because the library can't be found?)
In the logcat is displayed:
2020-08-25 08:43:43.472 22214-22238/? I/FirebaseCrashlytics: Crashlytics NDK initialization FAILED
2020-08-25 08:43:43.538 22214-22325/? D/TransportRuntime.SQLiteEventStore: Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
2020-08-25 08:43:43.561 22214-22341/? D/TransportRuntime.SQLiteEventStore: Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
2020-08-25 08:43:43.579 22214-22342/? D/TransportRuntime.SQLiteEventStore: Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
2020-08-25 08:43:43.591 22214-22343/? D/TransportRuntime.SQLiteEventStore: Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
2020-08-25 08:43:50.150 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.n0.a(SourceFile:1)
2020-08-25 08:43:50.150 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.d.run(SourceFile:2)
2020-08-25 08:43:50.150 22214-22338/? A/com.mypackagename: runtime.cc:574] "com.google.firebase.crashlytics.startup1" prio=5 tid=17 Waiting
2020-08-25 08:43:50.151 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.n0.a(SourceFile:1)
2020-08-25 08:43:50.151 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.d.run(SourceFile:2)
2020-08-25 08:43:50.172 22214-22338/? A/com.mypackagename: runtime.cc:574] native: #12 pc 00000000001a0c86 /data/app/com.mypackagename==/oat/arm64/base.vdex (com.google.firebase.crashlytics.d.m.j0.uncaughtException+86)
2020-08-25 08:43:50.173 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.Z.M(SourceFile:-1)
2020-08-25 08:43:50.173 22214-22338/? A/com.mypackagename: runtime.cc:574] - waiting to lock <0x06ca8488> (a com.google.firebase.crashlytics.d.m.Z) held by thread 13
2020-08-25 08:43:50.173 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.j0.uncaughtException(SourceFile:5)
2020-08-25 08:43:50.177 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.Z.M(SourceFile:-1)
2020-08-25 08:43:50.178 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.Z.M(SourceFile:-1)
2020-08-25 08:43:50.178 22214-22338/? A/com.mypackagename: runtime.cc:574] at com.google.firebase.crashlytics.d.m.j0.uncaughtException(SourceFile:5)
2020-08-25 08:43:50.178 22214-22338/? A/com.mypackagename: runtime.cc:574] native: #06 pc 000000000019f15c /data/app/com.mypackagename==/oat/arm64/base.vdex (com.google.firebase.crashlytics.d.m.Z.M)
2020-08-25 08:43:50.178 22214-22338/? A/com.mypackagename: runtime.cc:574] native: #12 pc 00000000001a0c86 /data/app/com.mypackagename==/oat/arm64/base.vdex (com.google.firebase.crashlytics.d.m.j0.uncaughtException+86)
Note that the native code is compiled with the project and is found on the jni folder, working properly (so it works for all the ABIs). I tried running on release and generating a signed APK from Build>Generate signed Bundle/APK.
Upvotes: 1
Views: 2164
Reputation: 742
Adding to @Kevin Kokomani's answer, you can follow this simple guide on how to properly set up Firebase Crashlytics for the NDK layer of your app.
Upvotes: 0
Reputation: 1616
From your log: 2020-08-25 08:39:27.258 16889-16889/? I/CrashlyticsCore: Initializing Crashlytics Core 2.7.0.33
This means that somewhere in your codebase there is a reference to a dependency from the old Fabric Crashlytics SDK. It's possible that the error you're running into is manifesting as a result of having elements of both the Fabric and Firebase Crashlytics SDKs in your setup. Make sure there's nothing in your codebase that could be referring to the old Fabric SDK, and that you've followed the upgrade instructions here to cleanly change out the old SDK for the new SDK.
Upvotes: 1