比 Logcat 更加美观易用的异常信息接收器: CrashWoodpecker

enframe_2015-09-02-17-51-03

因为我的 Android Studio 在使用的过程中, 经常会出现 App 崩溃了, 而 AS 自带的 logcat 并没有搜集到异常信息, 特别烦恼, 怎么折腾怎么重连都不痛快, 特别是对于那种 “启动崩” 的异常, 很难马上捕捉到, 丢失也是经常的.

所以我做了这么一个库, 仿造 Square 检测并展示内存泄露的 LeakCanary. 当开发过程中, 如果有没有处理的异常导致 crash, 使用了 CrashWoodpecker 以后, 便会起一个新的美观页面, 以很友好的方式即时展示异常信息. 更多内容可以参看一下我写在 GitHub 的文档:

CrashWoodpecker

An uncaught exception handler library like Square’s LeakCanary.

Getting started

NOTE: There is a big bug before VERSION 0.9.5, QAQ thank goodness, it has been fixed in version 0.9.5, please update to 0.9.5+.

In your build.gradle:

1
2
3
4
dependencies {
   debugCompile 'me.drakeet.library:crashwoodpecker:0.9.7'
   releaseCompile 'me.drakeet.library:crashwoodpecker-do-nothing:0.9.7'
}

In your Application class:

1
2
3
4
5
6
7
public class ExampleApplication extends Application {
 
   @Override public void onCreate() {
     super .onCreate();
     CrashWoodpecker.fly().to( this );
   }
}

And in your AndroidManifest.xml file:

1
2
3
4
5
< application
     android:name = ".ExampleApplication" // <--
     ...
     ...>
</ application >

That is all! CrashWoodpecker will automatically show an Activity when your app crash with uncaught exceptions in your debug build.

7BDF054B-21AE-4A66-ACBF-6A51B1A0FA96

Demo apk download: LittleWood.apk

源代码: https://github.com/drakeet/CrashWoodpecker

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值