18

I am using ACRA (Application Crash Report for Android) to send data when unhandled exceptions occur.

Methods like openFileOutput() requires me to try and catch iOExceptions. Since the exception is in a try catch block, ARCA is not triggered. However I would still like to receive and see the stacktrace. Are there any ways to achieve this?

Dheeraj Bhaskar
  • 18,633
  • 9
  • 63
  • 66
kevdliu
  • 1,709
  • 4
  • 29
  • 46

1 Answers1

29

If handling the IOException, etc. doesn't really make sense (i.e., there is really nothing you can do about it), wrap it in a RuntimeException and throw it. ACRA will catch and report this. If you don't want to crash the app, catch and handle it, then use handleException() to send a report manually:

ACRA.getErrorReporter().handleException(caughtException);

More details here

Zoe
  • 27,060
  • 21
  • 118
  • 148
Nikolay Elenkov
  • 52,576
  • 10
  • 84
  • 84
  • Is there any option for prevent ACRA from sending duplicate exception? (Duplicate exception means a duplicate exception from specific device) – Dr.jacky Jul 06 '15 at 03:01
  • 2
    Deduplicate exceptions at the server. You can't reasonably do this at client side, without maintaining a database of *all* exceptions sent so far. – Nikolay Elenkov Jul 06 '15 at 06:38