简体   繁体   English

具有处理异常的Android ACRA

[英]Android ACRA with handled exceptions

I am using ACRA (Application Crash Report for Android) to send data when unhandled exceptions occur. 我正在使用ACRA(Android的应用程序崩溃报告)在发生未处理的异常时发送数据。

Methods like openFileOutput() requires me to try and catch iOExceptions. 像openFileOutput()这样的方法要求我尝试捕获iOExceptions。 Since the exception is in a try catch block, ARCA is not triggered. 由于异常位于try catch块中,因此不会触发ARCA。 However I would still like to receive and see the stacktrace. 但是我仍然希望收到并看到堆栈跟踪。 Are there any ways to achieve this? 有没有办法实现这个目标?

If handling the IOException , etc. doesn't really make sense (ie, there is really nothing you can do about it), wrap it in a RuntimeException and throw it. 如果处理IOException等没有任何意义(即,你真的无能为力),请将它包装在RuntimeException并抛出它。 ACRA will catch and report this. ACRA将抓住并报告此事。 If you don't want to crash the app, catch and handle it, then use handleException() to send a report manually: 如果您不想使应用程序崩溃,请捕获并处理它,然后使用handleException()手动发送报告:

ACRA.getErrorReporter().handleException(caughtException);

More details here 更多细节在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM