Politchi Li
Politchi Li

Reputation: 11

How to collect ANR logs on devices below Android 11?

My device is running Android 9. On the Crashlytics page of the Firebase console, I can't view the ANR (Application Not Responding) logs. It is indicated that only the ANR logs of devices with Android 11 and above are collected. How can I solve this problem? I am currently using the free version. Do I need to upgrade to the paid version?

I hope that I can directly collect ANR (Application Not Responding) logs of low - version Android through Firebase, or there are other methods to collect ANR logs and report them to the Firebase platform.

Upvotes: 1

Views: 47

Answers (1)

snachmsm
snachmsm

Reputation: 19223

there is no such possibility in Firebase strictly, also not in paid version, thats the limitation of Android

but I think there might be some work around... there is a lib called ANR-WatchDog and in short you can get onAppNotResponding callback when ANR occurs. Implement it on lower Android versions and inside you can push some message to Firebase with

FirebaseCrashlytics.getInstance().recordException(e)

where e is your custom exception, which may contain collected useful info (e.g. RuntimeException("BOOM, ANR! wasLogged:$logged threads num:$threadCount")). Not the same as on Android 11+, but best I've figured out in similar case...

note that Firebase is sometimes reporting data not during current runtime, but in next session, especially when crash occurs - it may be (probably is) reported with next app start

Upvotes: 0

Related Questions