问题
I have been writing a simple Android application (one Activity).
I would really like to gather crash reports from actual user sessions. I know there are some nice 3rd-party libraries. I also read that Google Play Console (Android vitals) should be providing some basic telemetry including crash reports. I was thinking that, to keep things simple, I would stick with the Android vitals for now.
I was wondering whether there is anything I need to do on the Application side to get the crash reports. Or should I just simply let the App crash?
I handle exception that can be handled, but there is always a possibility that one makes it to, say, onCreate. 'onCreate' does not allow throwing checked exceptions though. If I cannot handle it, should I just wrap it in Runtime exception and throw that instead?
Thanks.
回答1:
Here's an article for a similar approach, https://proandroiddev.com/hide-your-crashes-gracefully-and-still-report-them-9b1c85b25875 However it does not rely on the Android OS crash reporting process; i.e. I don't think you would see the crashes in Android Vitals if you follow the steps described in the article.
You might be able to adapt it though, mainly in terms of restarting the app after the crash occurs.
来源:https://stackoverflow.com/questions/51830422/android-vitals-and-exception-handling