@zifeng328573112
2020-05-10T06:58:34.000000Z
字数 3625
阅读 259
ACRA全称: Application Crash Report for Android。是一个优秀的Android异常日志收集的开源框架, 利用他可以轻松的实现Android APP 异常日志的收集。
demo下载地址:https://cyril-zifeng-card.oss-cn-hangzhou.aliyuncs.com/CouchDB/acrademo-debug.apk
A.异常报告的几种提交方式:
B.可以在报告随意添加自己的内容
C.应用未崩溃的情况下, 也可以发送报告
D.如果没有网络,异常日志会暂时保存,连接网络后再发送
E.可以同 自托管报告接收脚本 一起使用
F.使用除静默提交外的任何一种提交方式, 系统自带的”强制关闭”对话框将不再弹出, 并且不会在要求发送异常报告.
G.允许发送报告到多种终端:
验证成功
@ReportsCrashes(formKey="dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ",
mode = ReportingInteractionMode.TOAST,
forceCloseDialogAfterToast = false, // optional, default false
resToastText = "提示内容")
public class MyApplication extends Application {
验证成功
@ReportsCrashes(formKey="dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ",
mode = ReportingInteractionMode.DIALOG,
resToastText = R.string.crash_toast_text, // 可选,在数据收集完毕之前弹出一个土司
resDialogText = R.string.crash_dialog_text,//对话框内容
resDialogIcon = android.R.drawable.ic_dialog_info, //可选, 对话框的图片
resDialogTitle = R.string.crash_dialog_title, // 可选,对话框的标题
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, //可选,提示用户输入异常产生的原因等
resDialogEmailPrompt = R.string.crash_user_email_label, // optional. When defined, adds a user email text entry with this text resource as label. The email address will be populated from SharedPreferences and will be provided as an ACRA field if configured.
resDialogOkToast = "提示内容" // 可选,提交后弹出土司
)
public class MyApplication extends Application {
验证成功
@ReportsCrashes(
resNotifTickerText = R.string.crash_notif_ticker_text,
resNotifTitle = R.string.crash_notif_title,
resNotifText = R.string.crash_notif_text,
resNotifIcon = android.R.drawable.stat_notify_error // optional. default is a warning sign
)
public class MyApplication extends Application {
验证成功
但有Bug:发送时必须附带图片,否则不能发送到邮箱;因问题出现在sdk jar包内部,暂未定位到具体Bug出现的地方。
@ReportsCrashes(formKey = "", // will not be used
mailTo = "reports@yourdomain.com",
customReportContent = { ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = "提示内容")
public class MyApplication extends Application {
验证失败
@ReportsCrashes(formKey = "", // will not be used
formUri = "http://yourserver.com/yourscript",
formUriBasicAuthLogin = "yourlogin", // 可选
formUriBasicAuthPassword = "y0uRpa$$w0rd", // 可选
mode = ReportingInteractionMode.TOAST,
resToastText = "提示内容")
public class MyApplication extends Application {
下一步需要在http://get.acralyzer.com/distrib-acra-storage 官方提供Acralyzer系统的地址上下载Acralyzer服务器的存储终端,用于存储统计详细信息【下图】
(因这个地址报404,不能访问;所以无法下载,后续服务器流程也走不下去)
解决结果:暂未解决,1,求助运维同事帮忙检测现搭建的CouchDB是否可用?Android崩溃信息是否发送到CouchDB上? 但需要我们搭建好服务器,部署到测试环境上才能检测到。
2,求助后台同事能否帮忙搭建测试服务器? 因工作任务较多,其次对CouchDB了解不多,且未接到这个任务;暂时抽不出时间。
A.Bugly:
目前钱包生活、钱包商家、阿基米德android app中已接入腾讯Bugly崩溃信息收集sdk【下图】
Bugly提供崩溃、ANR、错误日志等信息分析。
B.MTA:
同时也接入了MTA事件埋点【下图】
MTA提供新增用户、用户行为、事件分析等详细数据。
备注:
A.测试机型:华为安卓5.0,金立安卓5.1,华为安卓8.0,模拟器安卓7.0,其中华为安卓8.0测试失败.
B.配置时出现版本冲突(ACRA的com.android.support的是23.3.0,我们需要改成对应的编译版本,比如我的是28.0.0),需要在gradle下面添加如下代码:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}