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


当前回答

We use our home-grown system inside the company and it serves us very well. It's an android library that send crash reports to server and server that receives reports and makes some analytics. Server groups exceptions by exception name, stacktrace, message. It helps to identify most critical issues that need to be fixed. Our service is in public beta now so everyone can try it. You can create account at http://watchcat.co or you can just take a look how it works using demo access http://watchcat.co/reports/index.php?demo.

其他回答

在Android 2.2中,现在可以从Android市场应用程序中自动获得崩溃报告:

Android的新错误报告功能 市场应用让开发者能够做到这一点 接收崩溃和冻结报告 他们的用户。报告将会 当他们登录到他们的 出版商账户。

http://developer.android.com/sdk/android-2.2-highlights.html

如果你想立即得到答案,你可以使用logcat

$adb shell logcat -f /sdcard/logoutput.txt *:E

如果您的日志中现在有太多垃圾,请先尝试清除它们。

$adb shell logcat -c

然后尝试运行您的应用程序,然后再次logcat。

刚开始使用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个报告

我一直在Android和iOS应用中使用cratercism——我在techcrunch上听说过它们。到目前为止,他们都很满意!

好吧,我看了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卡。