Android生命体和异常处理 [英] Android vitals and exception handling

查看:69
本文介绍了Android生命体和异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在编写一个简单的Android应用程序(一个Activity).

I have been writing a simple Android application (one Activity).

我真的很想从实际的用户会话中收集崩溃报告.我知道有一些不错的第三方库.我还读到Google Play控制台(Android vitals)应该提供一些基本遥测功能,包括崩溃报告.我当时想,为了简单起见,我现在会坚持使用Android要点.

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?

我处理可以处理的异常,但是总是有可能使异常发生,例如onCreate.但是'onCreate'不允许抛出检查异常.如果我无法处理它,是否应该将其包装在Runtime异常中,然后抛出该异常?

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?

谢谢.

推荐答案

以下是有关类似方法的文章,

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.

这篇关于Android生命体和异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆