本文介绍了Android的 - 如何发送崩溃报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来,由于Android 2.2的,有用于发送崩溃报告的一个新功能,如提到的链接:

我如何使用这个功能?它是自动从市场上(即谷歌Play商店)下载的每个应用程序?我在哪里可以找到有关该功能的详细信息?

此外,它是可以自定义的是什么派,比如用DefaultExceptionHandler,并把我们自己的飞机坠毁的说明?

注意:我知道,有很多工具发送崩溃报告(如),但我首先要检查是否有可能使用什么已经GIVEN的。

编辑:我已经成功修改还传来的例外,希望这也将改变发送到谷歌的开发者网站上的报告

下面是一个示例code是相关的:

 私有静态类DefaultExceptionHandler实现java.lang.Thread.UncaughtExceptionHandler
...
@覆盖
公共无效uncaughtException(线程t,Throwable的E)
{
  最后的StackTraceElement [] exceptionStackTrace = e.getStackTrace();
  异常exception =新的异常(我的新例外!,E);
  最后的StackTraceElement [] newExceptionStackTrace =新的StackTraceElement [exceptionStackTrace.length + 1];
  System.arraycopy(exceptionStackTrace,0,newExceptionStackTrace,1,exceptionStackTrace.length);
  newExceptionStackTrace [0] =新的StackTraceElement(测试类,试验方法,测试文件,0);
  exception.setStackTrace(newExceptionStackTrace);
_defaultUEH.uncaughtException(T,例外); //希望这将调用异常的默认处理报告
}
 

解决方案

你在特性所描述听起来像身材,而据我所知,你不能自定义此。这些数据将被发送到其上载应用程序中的googlePlay开发帐户。我已经看到了由感,或自定义光盘制作自定义。让自己的日志的唯一方法,就是使用 DefaultErrorHandler 你提到的。作为一种很好的做法我会检查,如果你能发现自己的错误,(也许记录它的地方)。如果不是我会重新抛出这个错误,给用户一个机会,给你的暗示,他做了什么。

It seems that as of Android 2.2, there is a new feature for sending crash reports, as mentioned in the links:

How do I use this feature? Is it automatic for each application downloaded from the market (aka Google Play Store)?Where can I find more info about this feature?

Also, is it possible to customize what is being sent, perhaps by using DefaultExceptionHandler, and put our own description of the crash?

NOTE: i know that there are plenty of tools for sending crash reports (like ACRA) , but i wish to check first if it's possible to use what's already given.

EDIT: I've succeeded modifying the exception that is passed further, hoping that this will also change the report that is sent to the developer website of Google.

Here's a sample code that is relevant for this:

private static class DefaultExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler
...
@Override
public void uncaughtException(Thread t, Throwable e)
{
  final StackTraceElement[] exceptionStackTrace = e.getStackTrace();
  Exception exception = new Exception("my new exception!", e);
  final StackTraceElement[] newExceptionStackTrace = new StackTraceElement[exceptionStackTrace.length + 1];
  System.arraycopy(exceptionStackTrace, 0, newExceptionStackTrace, 1, exceptionStackTrace.length);
  newExceptionStackTrace[0] = new StackTraceElement("TEST CLASS", "TEST METHOD", "TEST FILE", 0);
  exception.setStackTrace(newExceptionStackTrace);
_defaultUEH.uncaughtException(t, exception); //this will hopefully call the default handling of the exception for reporting
}
解决方案

What you have described sounds like the build in feature, and as far as I know, you cannot customize this. The data will be send to the googlePlay dev account which uploaded the app. I have seen customizations made by Sense, or Custom Roms. The only way to get your own Logs, is to use the DefaultErrorHandler you mentioned. As a good practice I would check, if you can catch the error yourself, (maybe log it somewhere). If not I would rethrow this error, to give the user a chance to give you hints , what he has done

这篇关于Android的 - 如何发送崩溃报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 09:05
查看更多