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


当前回答

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

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

其他回答

这是非常野蛮的,但是可以在任何地方运行logcat,所以一个快速而肮脏的hack是在任何捕获块中添加getRuntime()。Exec ("logcat >> /sdcard/logcat.log");

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

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

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

$adb shell logcat -c

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

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

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.

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?