質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top