Question

Do you know how ACRA - the Android Crash reporting framework - works under the hood?

How does it hook-in to catch exceptions and errors? Is it using some global try/catch block to detect errors?

And does it affect performance and battery life by doing this?

Was it helpful?

Solution

ACRA works by setting up a default exception handler on the main thread. You can see that in the source code here:

   mDfltExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
   Thread.setDefaultUncaughtExceptionHandler(this);

It sets itself as the default uncaught exception handler at this point. Java will call this handler if there are any Exceptions that are thrown that are never caught by any try/catch block.

Since it's not really an active daemon or process, but rather part of your code (assuming you call ACRA.init()), it doesn't actually impact performance or battery life at all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top