How to use adb logcat?

Well I’ve tried to understand how to use it by reading these:

http://forum.unity3d.com/threads/70197-Any-tips-for-debugging-Android

but still, I have no clue how to do it, and what to do…
people are writing their comments as if it is obvious how to use these commands, but nothing work for me cause I can’t find a proper tutorial for new comers.

I really need a step by step guide, I would highly appreciate it, thanks.

If you’re using Unity with android, you must have already installed adb through Android SDK. Given that, yeah, it should be simple and obvious. And Ben is right. You didn’t seem to google enough or take any effort here… But I just hate simple unanswered questions.

So, quoting updated parts from Herman, there are just a couple things to assure:

  • Make sure USB debugging is enabled on the Android device (check under Settings → Development).
  • Run adb through the command prompt (with command line argument logcat) that comes with the Android SDK while running the game on the Android, still connected via USB to the computer.

And then, quoting eriQue, here’s a good command line to filter out stuff:

adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG

Finally, if the Android Debug Bridge can’t help you, I’m not sure what could. There was this one time, actually, it couldn’t help me… But I was ignoring a unity warning, so I did the debugging checklist in the wrong order.

  1. Run the Terminal and enter to:

/Users/YourUserName/Library/Android/sdk/platform-tools

  1. You must put a ’ ./ ’ before the code:

./adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG

I works for me.

Unity 5 v.5.3.2f1
Android Studio 1.3.2
OSX Yosemite

I guess you want to see unity logs on the android devices, so you try to use the logcat.

I have used adb logcat before, but it was very annoying.

So i give up using adb logcat and made a plugin which can provide an in-game console to view full Unity console logs on devices.

You can check it out here: Unity Asset Store - The Best Assets for Game Making

Enjoy it :slight_smile:

Simple,
You don’t need to do nothing (if you use studio), just open the logcat console and see the Unity debug prints there, you can also add a Unity tag to make it more readable.
You will see all your Debug.Log prints.

You can use Unity Package Manager with Android Logcat package.

For Mac users:

I prefer to use the Terminal instead of Unity Package.

To run Logcat you need to call the next command with your Unity version:

/Applications/Unity/Hub/Editor/2021.3.16f1/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG

You can also delete “ActivityManager PackageManager” to stay focused on Unity Logging

  1. Press shift → Right click → open command window here
  2. Then type “adb devices” without quotes in cmd
  3. It shows the list of devices
  4. Now type adb logcat > somename.txt
  5. Once you are done remove the usb. Then u will get the txt file and start exploring

ddms can’t log the unity log,bug adb logcat -s Unity could,@cawas,thans.

I had a problem where the debugger was showing no output. I am running OSX Mojave on a 2017 Macbook Pro (The horrible keyboard/touchbar/usb-c one). In order to get the logger working for me, I had to:

  1. Run adb shell

  2. Run adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG from within the shell.

Then everything started working as expected, but this SHOULD NOT have to happen, so there’s some sort of underlying bug at play here, that I’m sure won’t get fixed because I believe it’s on Apple’s side.