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


当前回答

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

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

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

其他回答

If your app is being downloaded by other people and crashing on remote devices, you may want to look into an Android error reporting library (referenced in this SO post). If it's just on your own local device, you can use LogCat. Even if the device wasn't connected to a host machine when the crash occurred, connected the device and issuing an adb logcat command will download the entire logcat history (at least to the extent that it is buffered which is usually a loooot of log data, it's just not infinite). Do either of those options answer your question? If not can you attempt to clarify what you're looking for a bit more?

Flurry analytics为你提供崩溃信息、硬件型号、android版本和实时应用使用统计数据。在新的SDK中,他们似乎提供了更详细的崩溃信息http://www.flurry.com/flurry-crash-analytics.html。

对于另一个崩溃报告/异常跟踪服务检查Raygun。io -它有一堆很好的逻辑处理Android崩溃,包括体面的用户体验时,将其插入到你的应用程序(两行代码在你的主活动和几行XML粘贴到AndroidManifest)。

当你的应用程序崩溃时,它会自动抓取堆栈跟踪,硬件/软件的环境数据,用户跟踪信息,任何你指定的自定义数据等。它异步地将其提交给API,这样就不会阻塞UI线程,如果没有可用的网络,它会将其缓存到磁盘。

免责声明:我构建了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.

使用这个来捕获异常细节:

String stackTrace = Log.getStackTraceString(exception); 

保存在数据库中,并维护日志。