-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suspiciously short list of threads when recording ANRError as Crashlytics non-fatal exception #58
Comments
Okay, this is by design :( Under the hood Crashlytics trims stack-traces longer then 1024 entries. ANRError collects all thread stacks as a single long stack-trace and it gets trimmed by Crashlytics. So the solution is either crash with Fatal error to allow Crashlytics collect all threads or collect threads by ourselves and send it somewhere. |
@AntonPetrov83 unrelated but would be cool if you could share your solution on how to use ANR-WatchDog with unity. Lots of people have now ANR issues since recently |
@mastef create a derived class from Then write something like that:
|
Got there after writing the comment. But the |
@AntonPetrov83 Thanks for the help! For future reference I'm adding the code here. Unfortunately I'm not able to trigger ANRs from Unity. package com.mycompany.gamepackage;
import com.github.anrwatchdog.ANRError;
import com.github.anrwatchdog.ANRWatchDog;
import com.github.anrwatchdog.ANRWatchDog.ANRListener;
import com.unity3d.player.UnityPlayerActivity;
import android.os.Bundle;
import android.util.Log;
public class GameActivity extends UnityPlayerActivity
{
// Setup activity layout
@Override protected void onCreate(Bundle savedInstanceState)
{
Log.d("GameActivity", "WatchDog starting");
new ANRWatchDog(3000)
.setIgnoreDebugger(true)
.setReportMainThreadOnly()
.setANRListener(new ANRWatchDog.ANRListener() {
@Override
public void onAppNotResponding(ANRError error) {
Log.e("GameActivity", "", error);
Log.d("GameActivity", "ANR Caught");
}
})
.start();
Log.d("GameActivity", "WatchDog started");
super.onCreate(savedInstanceState);
}
} This is confirmed working. Inside the Unity game loop I tried delaying stuff with |
Yeah, ANR triggers only when
Just call |
How to integrate ANR-WatchDog to a Unity game using custom implementation of UnityPlayerActivity? |
Hi!
I integrated ANR-WatchDog to a Unity game using custom implementation of UnityPlayerActivity.
At first I released a game with the default behaviour of the ANR-WatchDog.
My app crashed due to unhandled ANRError and Firebase Crashlytics recorded something around 40 threads at this moment including
UnityMain
thread and others. I usedsetReportMainThreadOnly()
because Crashlytics collects all threads by itself on fatal errors.Then I turned this crash to a non-fatal using this code:
This code records
ANRError
as a non-fatal exception and Crashlytics attaches stack traces contained inANRError
. That is why you do not seesetReportMainThreadOnly()
here any more. But now crash reports a very short, containing only 8-10 threads. What is strange there were noUnityMain
thread while this non-fatal was triggered in the middle of a gameplay.Please help, any ideas on how to get full list of stack traces attached?
The text was updated successfully, but these errors were encountered: