crashlytics NDK的crashlyticsDidDetectCrashDuringPreviousExecution [英] crashlyticsDidDetectCrashDuringPreviousExecution for crashlytics NDK

查看:112
本文介绍了crashlytics NDK的crashlyticsDidDetectCrashDuringPreviousExecution的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用crashlyticsDidDetectCrashDuringPreviousExecution来检测Java崩溃并将它们报告给我们的bi系统,但是我们的应用程序主要是C ++,并且我们使用的是rashlytics NDK,我们找不到与crashlyticsDidDetectCrashDuringPreviousExecution类似的东西.

在应用启动时我们能真正检测到NDK崩溃的任何方式吗?

谢谢 奥德(Oded)

解决方案

注意:仅适用于旧版本(Crashlytics 2.6.7和CrashlyticsNDK 1.1.6)

我也在寻找解决方案. 我们目前找到了部分解决方案.我不确定它有多好,它绝对不是官方的,而且它是异步的(我们正在尝试通过循环来克服),但这是我找到的最好的解决方案,并且看起来正在运行

Fabric.with(this, new Crashlytics.Builder().core(core.build()).build(), new CrashlyticsNdk(), new Crashlytics());
if (!userLeft) { // our handling to fix bug, see explanation below
    new Thread(new Runnable() {
        @Override
        public void run() {
            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.timestamp
                    break;
                }
            }
        }
    }).start();
}

userLeft的解释:

对于退出应用程序的用户,报告崩溃有一些错误,这是解决该问题的方法.我们将此标志设置为true,然后将其保存在设备上(SharedPreferences).我们在finish()函数的主活动(扩展了NativeActivity)上进行操作. 代码:

@Override
public void finish() {
    // set some key such as USER_LEFT to TRUE
    super.finish();
}

此后,只需获取该USER_LEFT值,将其分配给userLeft参数,然后在SharedPerferences上将其设置回false.

对这种解决方案有何见解?

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, we can't find anything similar to crashlyticsDidDetectCrashDuringPreviousExecution.

any way that we can actually detect an NDK crash when the app starts?

thanks Oded

解决方案

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 below
    new Thread(new Runnable() {
        @Override
        public void run() {
            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.timestamp
                    break;
                }
            }
        }
    }).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:

@Override
public void finish() {
    // set some key such as USER_LEFT to TRUE
    super.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?

这篇关于crashlytics NDK的crashlyticsDidDetectCrashDuringPreviousExecution的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆