Skip to content Skip to sidebar Skip to footer

Crashlyticsdiddetectcrashduringpreviousexecution For Crashlytics Ndk

We are using crashlyticsDidDetectCrashDuringPreviousExecution to detect java crashes and report them to our bi systems, but our app is mostly C++ and we are using crashlytics NDK,

Solution 1:

Mike from Fabric here.

Currently, there isn't a way to do this within Fabric or the SDK for an NDK crash.

Solution 2:

NOTE: This works on older version only (Crashlytics 2.6.7 and CrashlyticsNDK 1.1.6)

I'm also looking for a solution for this. We currently found a partial solution. I'm not sure how good it is, it's definitely not official, plus it's asynchronic (which we're trying to overcome by looping), but it's the best solution I found and it seems like it's working

Fabric.with(this, new Crashlytics.Builder().core(core.build()).build(), new CrashlyticsNdk(), new Crashlytics());
if (!userLeft) { // our handling to fix bug, see explanation belownew Thread(new Runnable() {
        @Override
        publicvoidrun() {
            SessionEventData crashEventData = null;
            for (int i = 0; i < 10; i++) {
                try {
                    Thread.sleep(1000); // in ms
                } catch (InterruptedException e) { }

                crashEventData = CrashlyticsNdk.getInstance().getCrashEventData();
                if (crashEventData != null)
                {
                    // there was a crash!// crash timestamp can be found at crashEventData.timestampbreak;
                }
            }
        }
    }).start();
}

Explaination for userLeft:

We had some bug with reporting crash for users that exited app, and this is the solution for that. We set this flag to true, and save it on the device (SharedPreferences). We do it on our main activity (which extends NativeActivity), on finish() func. Code:

@Overridepublicvoidfinish() {
    // set some key such as USER_LEFT to TRUEsuper.finish();
}

After that, just get that USER_LEFT value, assign it into userLeft param, and set it back to false on SharedPerferences.

Any insights about this solution?

Post a Comment for "Crashlyticsdiddetectcrashduringpreviousexecution For Crashlytics Ndk"