如何从我的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,也是这项服务的共同创建者。
其他回答
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?
虽然本页上的许多答案都很有用,但它们很容易过时。AppBrain网站汇总统计数据,让您找到当前最流行的崩溃报告解决方案:
Android崩溃报告库
你可以看到,在发布这张图片时,5.24%的应用使用了Crashlytics,安装率为12.38%。
这是非常野蛮的,但是可以在任何地方运行logcat,所以一个快速而肮脏的hack是在任何捕获块中添加getRuntime()。Exec ("logcat >> /sdcard/logcat.log");
谷歌Firebase是谷歌最新的(2016)方式,为您提供崩溃/错误数据在您的手机。 将它包含在您的构建中。Gradle文件:
compile 'com.google.firebase:firebase-crash:9.0.0'
致命崩溃会自动记录,不需要用户输入,你也可以记录非致命崩溃或其他事件,如下所示:
try
{
}
catch(Exception ex)
{
FirebaseCrash.report(new Exception(ex.toString()));
}
在Android 2.2中,现在可以从Android市场应用程序中自动获得崩溃报告:
Android的新错误报告功能 市场应用让开发者能够做到这一点 接收崩溃和冻结报告 他们的用户。报告将会 当他们登录到他们的 出版商账户。
http://developer.android.com/sdk/android-2.2-highlights.html
推荐文章
- 如何隐藏动作栏之前的活动被创建,然后再显示它?
- 是否有一种方法以编程方式滚动滚动视图到特定的编辑文本?
- 在Android中将字符串转换为Uri
- 如何在NestedScrollView内使用RecyclerView ?
- 移动到另一个EditText时,软键盘下一步点击Android
- Android应用中的GridView VS GridLayout
- Activity和FragmentActivity的区别
- 右对齐文本在android TextView
- 权限拒绝:start前台需要android.permission.FOREGROUND_SERVICE
- 如何更改android操作栏的标题和图标
- Android Split字符串
- 让一个链接在安卓浏览器启动我的应用程序?
- 如何在Android工作室的外部库中添加一个jar ?
- GridLayout(不是GridView)如何均匀地拉伸所有子元素
- 如何让一个片段删除自己,即它的等效完成()?