Logcat empty using ACRA on device
Asked Answered
R

2

7

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?

Ruysdael answered 28/1, 2013 at 22:25 Comment(2)
Having the same problem, neither acra 4.2.3 nor 4.4.0 gives any output on my 4.2.1 devices. Even playing with the acra @ReportsCrashes params makes no difference. Thanks a lot for any helpSkit
Did you able to get the Logcat on your device ? I am still not able to get it.Mentalism
T
6

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;

Transplant answered 18/9, 2013 at 12:0 Comment(1)
Thanks this helped me, I was able to email the logcat using ACRA-4.5.0 and running on android 4.1.2 targets (Jelly Bean).Donyadoodad
M
1

I suppose it is because starting with JellyBean you cannot use READ_LOGS anymore. For further explanation read here:

http://commonsware.com/blog/2012/07/12/read-logs-regression.html
Maximin answered 28/1, 2013 at 22:35 Comment(5)
Well, ACRA author says otherwise regarding the owning app logRuysdael
Can you provide some links? Maybe it is about providing to ACRA custom log files? I Doubt it would read logcat entries like crash dumps on 4.1+Maximin
If you are rooted/running from /system/app it can read logs apparently. If you're doing the root method you'd have to execute the application from a shell running as root. Which would be the responsibility of the app developer. (I am the developer of Log This)Hondo
The behavior documented in the ACRA wiki is based on this discussion: groups.google.com/d/msg/android-developers/6U4A5irWang/… - Dianne Hackborn: The kernel drive does this based on whether you have the permission to access the full logs. If not, it only gives you the logs associated with your uid. As I don't have any JellyBeans device, I only tested it on SDK emulator.Joses
@KevinGaudin, yeah, as far as I can tell I should be able to get my logs, but I don't. Again, on the emulator it works fine, but not on a device.Ruysdael

© 2022 - 2024 — McMap. All rights reserved.