crash反馈-----ACRA使用验证经历
2015-12-06 14:30
204 查看
ACRA是什么?
ACRA是一个用来反馈崩溃日志的android库。
崩溃日志发送到哪里?
ACRA支持多种后台方式,也支持自己定制后台
https://github.com/ACRA/acra/wiki/Backends
我个人是使用email的方式
怎么使用?
官方介绍了网址
https://github.com/ACRA/acra/wiki/BasicSetup
新建Application子类MyApplication,做些初始化
MyApplication.java
AndroidManifest.xml需要修改两点
1. 申请网络权限
2. 重定向Application为MyApplication
混淆后是否也能正确反馈崩溃堆栈呢?
混淆后也可以使用,但是需要对混淆配置做些修改。
配置文件为app目录下的文件proguard-rules.pro
编译release版本,反编译后用jdgui查看,验证了下,确实混淆了。
安装后,使用时产生的崩溃日志
能正确的定位到崩溃点。
具体文档可查看
https://github.com/ACRA/acra/wiki/ProGuard
ACRA是一个用来反馈崩溃日志的android库。
崩溃日志发送到哪里?
ACRA支持多种后台方式,也支持自己定制后台
https://github.com/ACRA/acra/wiki/Backends
我个人是使用email的方式
怎么使用?
官方介绍了网址
https://github.com/ACRA/acra/wiki/BasicSetup
新建Application子类MyApplication,做些初始化
MyApplication.java
@ReportsCrashes( mailTo = "youEMail@gmail.com", // my email here mode = ReportingInteractionMode.TOAST, resToastText = R.string.crash_toast_text) public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); ACRA.init(this); } }
AndroidManifest.xml需要修改两点
1. 申请网络权限
2. 重定向Application为MyApplication
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:name="MyApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > ... </application>
混淆后是否也能正确反馈崩溃堆栈呢?
混淆后也可以使用,但是需要对混淆配置做些修改。
buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
配置文件为app目录下的文件proguard-rules.pro
#==================================== #ACRA specifics # Restore some Source file names and restore approximate line numbers in the stack traces, # otherwise the stack traces are pretty useless -keepattributes SourceFile,LineNumberTable # ACRA needs "annotations" so add this... # Note: This may already be defined in the default "proguard-android-optimize.txt" # file in the SDK. If it is, then you don't need to duplicate it. See your # "project.properties" file to get the path to the default "proguard-android-optimize.txt". -keepattributes *Annotation* # Keep all the ACRA classes -keep class org.acra.** { *; }
编译release版本,反编译后用jdgui查看,验证了下,确实混淆了。
安装后,使用时产生的崩溃日志
USER_COMMENT=null ANDROID_VERSION=4.3 APP_VERSION_NAME=1.0 BRAND=samsung PHONE_MODEL=GT-N7102 CUSTOM_DATA= STACK_TRACE=java.lang.NullPointerException at com.example.jacksonke.configchangedemo.MainActivity$PlaceholderFragment.makeCrash(MainActivity.java:107) at com.example.jacksonke.configchangedemo.b.doClick(MainActivity$PlaceholderFragment$$ViewBinder.java:28) at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) at android.view.View.performClick(View.java:4475) at android.view.View$PerformClick.run(View.java:18786) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5528) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025) at dalvik.system.NativeStart.main(Native Method)
能正确的定位到崩溃点。
具体文档可查看
https://github.com/ACRA/acra/wiki/ProGuard
相关文章推荐
- 如何让iOS 保持界面流畅?这些技巧你知道吗
- 剑指offer系列之十二:调整数组顺序使奇数位于偶数前面
- 路径里有'#'符号影响VS2013工具箱添加第三方dll组件
- 数据结构C++实现——二叉树
- 纯C语言的工作有前(钱)景吗?
- 用Qemu模拟vexpress-a9 (二) --- 搭建u-boot调试环境
- 2015年12月App Store提交审核流程(Xcode7,iOS9)
- 数据结构实验之查找五:平方之哈希表
- Visual BCD Editor - Windows 7, Windows 10/8/Vista
- iOS中创建UITableViewCell的正确姿态
- <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>标签再使用时报错
- 关于hightchart的使用,报Highcharts error #15: www.highcharts.com/errors/15
- 用cocos2d-x模拟单摆运动的程序
- [JavaWeb基础] 028.CSS简介和基础语法
- TEX Quotes(字符串,水)
- ibatis selectKey用法问题
- 【转】Qt中Ui名字空间以及setupUi函数的原理和实现
- Java排序算法
- c#学前准备
- leetcode Binary Tree Paths python