gpt4 book ai didi

具有已处理异常的 Android ACRA

转载 作者:IT王子 更新时间:2023-10-28 23:36:53 28 4
gpt4 key购买 nike

当发生未处理的异常时,我正在使用 ACRA(Android 应用程序崩溃报告)发送数据。

openFileOutput() 等方法需要我 try catch iOExceptions。由于异常位于 try catch block 中,因此不会触发 ARCA。但是我仍然想接收并查看堆栈跟踪。有什么方法可以实现吗?

最佳答案

如果处理 IOException 等真的没有意义(即,你真的无能为力),将其包装在 RuntimeException 中并丢它。 ACRA 将捕获并报告此情况。如果你不想让应用崩溃,捕获并处理它,然后使用 handleException() 手动发送报告:

ACRA.getErrorReporter().handleException(caughtException);

更多详情 here

关于具有已处理异常的 Android ACRA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12945256/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com