Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logcat empty using ACRA on device

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?

like image 772
Magnus Johansson Avatar asked Jan 28 '13 22:01

Magnus Johansson


People also ask

How do I stop Logcat from clearing?

Prevent clearing the log when the app crashes By default when the app got crashed the logcat clear's in the android studio. To prevent this, click the right end chooser(Filter Configuration chooser) in the logcat tab then select Edit Filter Configuration option and enter current app name and package name.

What does Logcat stand for?

Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.


1 Answers

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 = "[email protected]",
    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;

like image 98
user2118199 Avatar answered Oct 03 '22 20:10

user2118199