EDIT
With credit to F43nd1r, the solution is to put LOGCAT in your ReportsCrashes annotation, e.g.
@ReportsCrashes (
mailTo = "log@perinote.com",
mode = ReportingInteractionMode.TOAST,
customReportContent = {ReportField.ANDROID_VERSION,
ReportField.STACK_TRACE,
ReportField.LOGCAT},
resToastText = R.string.crash_toast_text
)
ORIGINAL POST
I'm trying out ACRA and would like it to capture the stack trace and logcat. At the moment, I have it configured to invoke my email app to send the data. Upon a crash, it is display a toast and is opening the email app with the stack trace in the message body. However, there is no logcat.
As best as I can tell according to the documentation, when I put the READ_LOGS permission in the manifest, it should include the last 200 lines of the logcat in the report.
I'm testing on an Android 7.0 device.
manifest:
<manifest package="com.perinote.crashtest"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.READ_LOGS"></uses-permission>
<application
...
</application>
</manifest>
package com.perinote.crashtest;
import ...;
@ReportsCrashes (
mailTo = "log@perinote.com",
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text
)
public class AppSubclass extends Application
{
@Override
protected void attachBaseContext(Context base)
{
super.attachBaseContext(base);
ACRA.init (this);
}
}
I don't think any other of my files are relevant, but let me know if you need more info.
Including a full report could be quite difficult due to the data size. Default fields included in email reports are:
- ReportField.USER_COMMENT
- ReportField.ANDROID_VERSION
- ReportField.APP_VERSION_NAME
- ReportField.BRAND
- ReportField.PHONE_MODEL
- ReportField.CUSTOM_DATA
- ReportField.STACK_TRACE
Source: Sending Reports by Mail
So, if you want to include logcat, you have to modify the report fields to include ReportField.LOGCAT.
Note that starting from ACRA 4.9.3 (Unreleased) you'll be able to send the report as a mail attachment instead of as body, so size shouldn't be a problem anymore. Until then, including logcat might result in unsendable reports (as they might exceed character limits imposed by mail providers).
The above answer only applies to ACRA 4.x. In ACRA 5.x the default configuration is the same for all senders and does include logcat.