如何从我的Android应用程序中获得崩溃数据(至少堆栈跟踪)?至少在我自己的设备上工作时可以通过电缆检索,但理想的情况是,从我的应用程序在野外运行的任何实例中都可以,这样我就可以改进它,使它更可靠。


当前回答

您还可以为它使用整个(简单的)服务,而不仅仅是库。我们公司刚刚为此发布了一项服务:http://apphance.com。

It has a simple .jar library (for Android) that you add and integrate in 5 minutes and then the library gathers not only crash information but also logs from running application, as well as it lets your testers report problems straight from device - including the whole context (device rotation, whether it is connected to a wifi or not and more). You can look at the logs using a very nice and useful web panel, where you can track sessions with your application, crashes, logs, statistics and more. The service is in closed beta test phase now, but you can request access and we give it to you very quickly.

声明:我是Polidea的CTO,也是这项服务的共同创建者。

其他回答

谷歌改变了你实际得到的崩溃报告的数量。以前你只能得到手动报告的错误报告。

自从上次开发者大会和Android Vitals的引入,你也会从用户那里得到崩溃报告,这些用户已经启用了共享诊断数据。

您将看到从用户选择自动共享使用情况和诊断数据的Android设备收集的所有崩溃。可获得前两个月的数据。

查看崩溃和应用程序未响应(ANR)错误

刚开始使用ACRA https://github.com/ACRA/acra使用谷歌形式作为后端,它非常容易设置和使用,这是默认的。

但是发送报告到谷歌表单将被弃用(然后删除): https://plus.google.com/118444843928759726538/posts/GTTgsrEQdN6 https://github.com/ACRA/acra/wiki/Notice-on-Google-Form-Spreadsheet-usage

无论如何,可以定义自己的发件人 https://github.com/ACRA/acra/wiki/AdvancedUsage#wiki-Implementing_your_own_sender 例如,你可以试着给发件人发电子邮件。

用最少的努力就可以将报告发送到bugsense: http://www.bugsense.com/docs/android#acra

注意:无bug感知账号每月最多500个报告

您还可以为它使用整个(简单的)服务,而不仅仅是库。我们公司刚刚为此发布了一项服务:http://apphance.com。

It has a simple .jar library (for Android) that you add and integrate in 5 minutes and then the library gathers not only crash information but also logs from running application, as well as it lets your testers report problems straight from device - including the whole context (device rotation, whether it is connected to a wifi or not and more). You can look at the logs using a very nice and useful web panel, where you can track sessions with your application, crashes, logs, statistics and more. The service is in closed beta test phase now, but you can request access and we give it to you very quickly.

声明:我是Polidea的CTO,也是这项服务的共同创建者。

我在这里做了我自己的版本: http://androidblogger.blogspot.com/2009/12/how-to-improve-your-application-crash.html

这基本上是相同的事情,但我使用邮件而不是http连接来发送报告,更重要的是,我添加了一些信息,如应用程序版本,操作系统版本,手机型号,或可用内存到我的报告…

好吧,我看了rrainn和Soonil提供的样本,我找到了一个解决方案 这不会破坏错误处理。

我修改了CustomExceptionHandler,以便它从我们关联的新线程中存储原始的UncaughtExceptionHandler。在新的“uncaughtException”的末尾- 方法,我只是使用存储的UncaughtExceptionHandler调用旧函数。

在DefaultExceptionHandler类中,你需要这样的东西:

public class DefaultExceptionHandler implements UncaughtExceptionHandler{
  private UncaughtExceptionHandler mDefaultExceptionHandler;

  //constructor
  public DefaultExceptionHandler(UncaughtExceptionHandler pDefaultExceptionHandler)
  {
       mDefaultExceptionHandler= pDefaultExceptionHandler;
  }
  public void uncaughtException(Thread t, Throwable e) {       
        //do some action like writing to file or upload somewhere         

        //call original handler  
        mStandardEH.uncaughtException(t, e);        

        // cleanup, don't know if really required
        t.getThreadGroup().destroy();
  }
}

在http://code.google.com/p/android-remote-stacktrace上对代码进行了修改 你有一个很好的工作基地,登录到你的web服务器或 sd卡。