Logcat empty using ACRA on device
acra, android, logcat
Solution
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.
(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
)
Note: I excluded the USER_CONTENT and CUSTOM_DATA field
Note2: `import org.acra.ReportField;`
Problem
So I'm using ACRA 4.4.0 with all defaults, and my logcat field is empty. My app has the ``` <uses-permission android:name="android.permission.READ_LOGS" /> ``` permissions, which should at least give me my own app logs since Jelly Bean. Final note: READ_LOG permission is not granted to third-party apps anymore since Android 4.1 (JellyBean). Starting with this version, logcat provides only traces from your own app, without requiring a permission. JellyBean logcat logs are retrieved by ACRA starting with version 4.3.0b2 So I do a forced log: ``` Log.i("mytag" , "message"); ACRA.getErrorReporter().handleException(null); ``` 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. Anyone has any ideas?