Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Logcat works fine in emulators, not fine in real device

I execute Logcat from a service in my app.

commandLine = "logcat -v time -b main"
process = Runtime.getRuntime().exec(commandLine);

When it runs on any AVD, it catches all log messages from any process running in the system.
When I run it in a real device (ASUS TF201) by copying the apk and installing the app in the normal way, it only catches log messages from my own applicaton.

The app runs fine, no crashes, all activities work fine, even the activity that starts and stops the logcat. The only difference between a run in AVD and a run in the device is the missing messages. I know there are missing messages because I run aLogCat besides my app and aLogCat does catch all messages.

What am I missing?

like image 207
ilomambo Avatar asked Dec 15 '25 15:12

ilomambo


1 Answers

This should always have been the intended behavior and is rightly fixed in Jelly Bean. Every application should only be able to access logcat information relevant to its own process.

In your case, you need to run the command as root to access logcat messages not belonging to your application.

-- References --

SO Question

Discussion

Android issue

aLogCat User comments

Hope this satisfies your curiosity.

like image 92
PravinCG Avatar answered Dec 19 '25 07:12

PravinCG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!