分析崩溃

AppMetrica 不与其他收集和处理应用崩溃的库冲突。 如果使用这些库,请在安装这些库后初始化 AppMetrica。

AppMetrica SDK 将崩溃报告保存到文件中,并在下次运行时发送。

该库不会对应用崩溃进行符号化或去混淆处理。 这些操作在服务器端或客户端执行。

要将映射文件上传到AppMetrica,请使用AppMetricaGradle Plugin。 它在构建应用时会自动上传映射文件和SO文件。 要获取更多信息,请查看在 Android 上上传映射文件和调试符号。

为了自动收集应用崩溃的信息,AppMetrica 使用标准处理程序 Thread.UncaughtExceptionHandler。 如果您直接在应用中使用应用崩溃处理程序,请使用以下正确处理数据的实现示例:

val previousUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler()
// Creating a new handler.
val uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { thread, exception ->
    try {
        // Put your logic here.
    } finally {
        // Sending a message about an app crash to the system handler.
        previousUncaughtExceptionHandler?.uncaughtException(thread, exception)
    }
}
// Setting the default handler.
Thread.setDefaultUncaughtExceptionHandler(uncaughtExceptionHandler)
final Thread.UncaughtExceptionHandler previousUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
// Creating a new handler.
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
    @Override
    public void uncaughtException(@NotNull Thread thread, @NotNull Throwable exception) {
        try {
            // Put your logic here.
        } finally {
            // Sending a message about an app crash to the system handler.
            if (previousUncaughtExceptionHandler != null) {
                previousUncaughtExceptionHandler.uncaughtException(thread, exception);
            }
        }
    }
};
// Setting the default handler.
Thread.setDefaultUncaughtExceptionHandler(uncaughtExceptionHandler);

这样你可以自己处理异常,然后传递它,AppMetrica 可以发送有关它的信息。

如果您想传输关于应用崩溃的额外信息,请参考此示例,直到在应用中初始化库。

了解更多

如果您没有找到所需答案,可以通过反馈表单提交您的问题。 请尽可能详细地描述问题。 如果可能,请附上截图。

联系支持 为文档提出改进建议