异常信息接收器CrashWoodpecker

来源:互联网 发布:机器人仿真软件 编辑:程序博客网 时间:2024/06/05 02:40

在写APP应用的时候经常会遇到某个Activity出问题而导致APP崩溃,而Android Studio 自带的 logcat 并没有搜集到异常信息,特别是对于那种 “启动崩” 的异常, 很难马上捕捉到, 丢失也是经常的。当开发过程中, 如果有没有处理的异常导致 crash, 使用了 CrashWoodpecker 以后, 便会起一个新的美观页面, 以很友好的方式即时展示异常信息。这对于查看错误信息有很大帮助。
现在介绍怎么使用:

1.配置build.gradle

compileSdkVersion 23 buildToolsVersion "21.1.2" targetSdkVersion 23

2.引用CrashWoodpecker库

dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    debugCompile 'me.drakeet.library:crashwoodpecker:0.9.7'    releaseCompile 'me.drakeet.library:crashwoodpecker-do-nothing:0.9.7'}

3.新建一个Application类

public class AppTest extends Application {    @Override    public void onCreate() {        super.onCreate();       CrashWoodpecker.fly().to(this);    }}

4.在Manifest.xml配置Application类

 <application        android:allowBackup="true"        android:icon="@drawable/ic_launcher"        android:label="@string/app_name"        android:name=".AppTest"        android:theme="@style/AppTheme" >
0 0
原创粉丝点击