Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to report third party NDK crashes using crashlytics

I am getting the following NDK crash report from Google Play Console, but not in Crashlytics.

#00  pc 0000000000049c44  /system/lib/libc.so (tgkill+12)
#01  pc 00000000000473e3  /system/lib/libc.so (pthread_kill+34)
#02  pc 000000000001d535  /system/lib/libc.so (raise+10)
#03  pc 0000000000019081  /system/lib/libc.so (__libc_android_abort+34)
#04  pc 00000000000170e4  /system/lib/libc.so (abort+4)
#05  pc 000000000000c3a1  /system/lib/libcutils.so (__android_log_assert+112)
#06  pc 000000000002352d  /system/lib/libhwui.so
#07  pc 0000000000024db3  /system/lib/libhwui.so
#08  pc 00000000000281a9  /system/lib/libhwui.so (_ZN7android10uirenderer12renderthread12RenderThread10threadLoopEv+80)
#09  pc 000000000000e361  /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+140)
#10  pc 0000000000064d19  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv+80)
#11  pc 0000000000046eb3  /system/lib/libc.so (_ZL15__pthread_startPv+22)
#12  pc 0000000000019acd  /system/lib/libc.so (__start_thread+6)

I would like to have Crashltytics to also report these crashes. We don't use any NDK library and the crash should be coming from external 3rd party libraries. I am reading https://docs.fabric.io/android/crashlytics/ndk.html, yet still not sure how to do it.

Question 1

Given that I am already using Crashlytics in my Android app, what is the exact configuration change I have to make/add to have crashlytics report NDK crashes from external 3rd party library?

Question 2

In https://docs.fabric.io/android/crashlytics/ndk.html, it mentioned Uploading symbols for external dependencies. What are symbols? Should I care about it?

Thanks in advance.

like image 678
Xi Wei Avatar asked Jan 25 '18 21:01

Xi Wei


People also ask

How do I log errors in Crashlytics?

Logging Non-Fatal Events: try { myMethodThatThrows(); } catch (Exception e) { Crashlytics. logException(e); // handle your exception here! } Crashlytics. log("msg") is good for only as an additional complement for a possible future exception, otherwise, a dev will not find it on the Crashltyics dashboard.


1 Answers

You can include craslytics ndk to your build.gradle, and the native crashes will be reported in the same dashboard. Recently, crashlytics got integrated with Firebase.

crashlytics {
  enableNdk true
}
implementation 'com.crashlytics.sdk.android:crashlytics:2.8.0'
implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.0.1'

And in Java you must add NDK:

Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());

nativeInitCrashlytics();

Uploading symbols, these reports may get more meaningful, but this is not relevant for you, because you don't have sources for the third party native libs, and it does not really help to know the name of the function where it crashes.

This said, please note that it's quite possible that this specific crash will still not appear in Crashlytics dashboard. The stack suggests that some hardware accelerated rendering procedure failed. There may be no direct relation to your code.

like image 148
Alex Cohn Avatar answered Nov 14 '22 03:11

Alex Cohn