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

南楼画角 提交于 2019-11-27 07:37:47
  1. Enable USB debugging in your device.

  2. Connect device to computer

  3. Use this commands

--> $adb devices (will give the "device id" that is connected) output ex. 82990AB830201D device

--> $adb -s "device id" logcat (you will be able to see your device logcat)

ex $adb -s 82990AB830201D logcat

I follow this steps and it works good.

Don't forget to check Settings -> Applications -> USB debugging. Then

 $ adb -d logcat

will show log messages.

  1. Get list of devices:

    adb devices

You will get this:

List of devices attached
emulator-5554   device
0123456789ABCDEF        device
  1. Run log with parameters like this:

    adb -s "0123456789ABCDEF" logcat MyTag:D *:S

where "MyTag" is tag used in Log.d("MyTag", value) or you will get too many text.

This is the best way to use LogCat via command line:

adb logcat -v time > log.txt

you can do "adb -d logcat". This should work.

Try downloading Catlog to your phone

Had the same issue but added a filter in the logcat and only give him a name and set log level to "verbose". You can try that.

I can't see the complete message of some exceptions if the message are to long. Scrolling doesn't function very well.

(Using Eclipse)

Jelmert

have you installed ADB drivers for the device?

What does adb devices return?

Emulators are named like emulator-5554 etc. If your device is properly installed you should see it too. The name depends on which manufacturer you are using.

If you don't see your device, the drivers are not installed correctly. Do some searches for "adb install drivers" on Google. Here's a hit that might do it for you: http://forum.xda-developers.com/showthread.php?t=502010

You probably need to activate logging on your mobile device too.

In the case of my Huawei device, I need to enter the phone number: ##2846579##

to get into a service menu. From there I could activate logging. Not sure what device you are using, but probably there is some service menu there too.

Once done, reboot and try again with adb -d logcat

Cheers Christian

On the windows command/Linux shell, issue the command below,

adb devices 

if the device is not listed in result, then install "APK installer", which can help install the adb driver in your windows machine. Link is below:

http://apkinstaller.com/downloads/

Check the listing again with the command above in the shell/cmd, and if the device is listed then Log Cat will surly work.

After that you can try:

adb -d logcat

Check the tutorial on YouTube: https://youtu.be/vO0Wf0E6Z4o

Happy Coding :-)

  1. Enable USB debugging in your device.
  2. Connect your device to computer
  3. Open Android Studio
  4. Click on View/Tool Windows/Logcat (or Alt+6)
  5. Select your device on the top left combo box

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!