点击按钮,从eclipse LogCat
发送我的应用程序当前事件日志。
我发现我们可以通过定义 -
来做到这一点String logcatArguments[] = { "-t", "100", "-v", "long","ActivityManager:I" ,"*:D","*:S"};
但是当我点击按钮时发送ACRA时,LOGCAT
将变为空白""。
如何使用ACRA做到这一点?
我从 -
获得了帮助Sending-reports-for-caught-exceptions-or-for-unexpected-application-state-without-any-exception
按钮点击的实施 -
view.findViewById(R.id.logdone).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String logcatArguments[] = { "-t", "100", "-v", "long","ActivityManager:I" ,"*:D","*:S"};
ACRAConfiguration config = ACRA.getConfig();
config.setMailTo("blabla@xyz.com");
config.setResToastText(R.string.crash_dialog_ok_toast);
config.setLogcatArguments(logcatArguments);
try
{
config.setMode(ReportingInteractionMode.TOAST);
}
catch (ACRAConfigurationException e)
{
e.printStackTrace();
}
ACRA.setConfig(config);
ACRA.getErrorReporter().handleException(null);
try {
config.setMode(ReportingInteractionMode.SILENT);
} catch (ACRAConfigurationException e) {
e.printStackTrace();
}
ACRA.setConfig(config);
}
});
我的应用类代码 -
@ReportsCrashes(formKey = "",
mailTo = "blabla@xyz.com",
customReportContent = { ReportField.USER_CRASH_DATE, ReportField.USER_COMMENT, ReportField.USER_EMAIL,
ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.BRAND, ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME, ReportField.STACK_TRACE, ReportField.APPLICATION_LOG,
ReportField.LOGCAT
},
mode = ReportingInteractionMode.DIALOG,
resDialogText = R.string.crash_dialog_text)
@Override
public void onCreate() {
super.onCreate();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
答案 0 :(得分:0)
尝试设置ACRA时遇到了类似的问题。我的问题是我没有在Android Manifest中读取登录权限。
<uses-permission android:name="android.permission.READ_LOGS"></uses-permission>
只是仔细检查。