Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using adb logcat with a real phone (and not the emulator)

when I'm using the Android emulator I can do "adb logcat" to see output messages (log / system.out.println) originated from my code. It also shows the stack trace of exceptions which happen during execution.

But, when I'm using a real phone, "adb logcat" does not do / show anything.

I also tried "adb -d logcat" which also does not display anything.

Is there any way to get it working with the real phone?

Thanks.

UPDATE:

I just tried "adb -s ? logcat" ('?' is the serial number of the device) and also got no results.

I tried another "adb" command to see if anything was working: "adb -s ? bugreport". This printed a lot of stuff. Example: "Memory Info", "CPU Info" and some Java specific things. So it seams that some stuff is working.

like image 281
MyName Avatar asked Sep 14 '10 10:09

MyName


People also ask

Can I run adb commands from phone?

8. Finally, you can run ADB commands on your Android device without any computer. You don't need to add adb or adb shell initializers in this app as you are already within the local ADB shell.

How can I get Logcat on my Android phone?

View your app logs Build and run your app on a device. Click View > Tool Windows > Logcat (or click Logcat in the tool window bar).


1 Answers

  1. Enable USB debugging on your device.

  2. Connect the device to computer

  3. Use these commands:

Get the "device id"

adb devices 

example:

$ adb devices List of devices attached 5856423841563398    device emulator-5554   device 

To specify the device when using logcat

adb -s "device id" logcat 

example:

$ adb -s 5856423841563398 logcat --------- beginning of crash 03-31 15:56:51.174 13547 13547 E AndroidRuntime: FATAL EXCEPTION: main 
like image 89
AndreS Avatar answered Sep 21 '22 15:09

AndreS