本文介绍了logcat的空设备上使用ACRA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我使用ACRA 4.4.0与所有默认值,而我的logcat字段为空。

So I'm using ACRA 4.4.0 with all defaults, and my logcat field is empty.

我的应用程序有

<uses-permission android:name="android.permission.READ_LOGS" />

权限,这至少应该给我my自己的应用程序日志因为<一个href=\"https://groups.google.com/forum/?fromgroups=#!searchin/android-developers/READ_LOGS/android-developers/6U4A5irWang/8xOi74KfRIYJ\">Jelly豆。

最后说明:READ_LOG权限不授予第三方应用
  再由于Android 4.1(软糖)。这个版本开始,
  logcat中只提供了痕迹从你自己的应用,而无需
  允许。软糖的logcat日志由ACRA开始检索
  版本4.3.0b2

于是,我做了强制日志:

So I do a forced log:

Log.i("mytag" , "message");
ACRA.getErrorReporter().handleException(null);

在模拟器(V4.2),我得到充分的logcat的。 (这是BTW有些矛盾的JB强加限制logcat中)结果
然而,在我的设备V4.2.1中,logcat的完全是空的。

On the emulator (v4.2), I get the full logcat. (Which BTW is somewhat contradictory to the JB imposed logcat restriction)
However, on my device v4.2.1, the logcat is completely empty.

任何人有什么想法?

推荐答案

如果您正在使用电子邮件模式ACRA报告里面 @(的mailto 标签ReportsCrashes )不包括在LogCat中字段降低报告大小。为了解决这个问题,你只需要使用customReportContent标签。

If you are using email-mode acra reporting (mailTo tag inside @ReportsCrashes) the LogCat field isn't included to decrease the report size. To get around this you just need to use the customReportContent tag.

(过了好一会儿,我发现这个之前搜索的 - 这是写在文档中,只是没有在节提LogCat中)

(Took a while of searching before I found this - it is written in the documentation, just not in the section mentioning LogCat)

@ReportsCrashes(formKey = "",
    mailTo = "xxxx@yyyy.com",
    customReportContent = {ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.STACK_TRACE, ReportField.LOGCAT },
    mode = ReportingInteractionMode.TOAST,
    resToastText = R.string.crash_toast_text
)

请注意:我排除了USER_CONTENT和CUSTOM_DATA领域

Note: I excluded the USER_CONTENT and CUSTOM_DATA field

注2:进口org.acra.ReportField;

这篇关于logcat的空设备上使用ACRA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 09:31
查看更多