- Home /
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
http://answers.unity3d.com/questions/175161/debugging-android.html
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.
From the first link: "There is something called the logcat, which is a combined message pipe from all applications. To read it you first need to locate the adb tool that comes with the Android SD$$anonymous$$. Depending on which version you have of the SD$$anonymous$$ the adb is located either under /tools or/platform-tools."
It's all there... all you have to do is read.
PS: This is a question-answer forum. If you are requesting a tutorial, this is not the place.
Also adb logcat has nothing to do with Unity. It can be used for anything. Look up "adb logcat tutorial" and you will find $$anonymous$$ANY step by step guides on how to use it.
I found it, but this is exactly what I'm asking. what next? should I move it into my android device? should I open it on the PC? what to do?
Please use Google as I have advised. There's even a video tutorial on how to do it!
http://www.youtube.com/watch?v=2AHJsR$$anonymous$$a_J8
Answer by cregox · Nov 07, 2013 at 08:44 PM
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.
First, thanks for the answer.
Second, here is what I didn't know. you wrote:
"Run adb through the command prompt (with command line argument logcat) that comes with the Android SD$$anonymous$$ while running the game on the Android, still connected via USB to the computer."
I had no clue that I needed to actually copy the cmd.exe file into the "platform-tools" folder and activate the command prompt in there so it would work. (or to write to exact location of the adb.exe file in cmd) in no tutorial there was an explanation for this, and only this guide actually explained that
Not all of us are Software Engineers.. otherwise I would'nt ask this question. :)
By the way, this utility only shows the unity console? or is there some more important info I can get using it?
You don't need to be an engineer to know about the command prompt. But that's cool, dude. I saw your pain, reason why I decided to write a detailed answer. Glad I could hit something! ;-)
This shows the android console. It has nothing to do with Unity, it doesn't even need to know Unity exists. There might be some more important info you can get using it, but that will most likely be true only if you're using tools outside Unity (which you probably aren't).
You really don't need (and shouldn't) copy cmd.exe into the android tools folder. adb is "just" a program. To run it you have to specify the right location of the program.
This can be done by:
"browsing" to the actual folder inside your command prompt where the adb exe is located. The "cd" command (change directory) might be useful.
Create a shortcut to adb.exe and edit the shortcut properties to add additional parameters you want to pass to adb
Same as above but more versatile: Create a shortcut to cmd.exe and change the working directory to the directory of your adb location. When you open the cmd with this shortcut it should start in the tools directory and you can directly type "adb xxxx"
The most common one is to add the directory to the default search path. This is what i do with most tools which i know i'm going to use them quite a lot ;). If you've done that, you can start the ADB from any command prompt from any directory. $$anonymous$$eep in $$anonymous$$d to restart cmd or the changes wouldn't apply. Before you ask how you add an directory to the PATH environment variable, see this
Update: Going to my SD$$anonymous$$ Platform-tools folder I held the shift key and right clicked in the folder then chose "Open command window here" This gives you the path and you can start typing adb logcat. With this method I got "-waiting for device-" however the devise is plugged in and stuck at the splash screen of the app.
So Shift + right-click in the folder with the adb.exe may be of use to someone.
Another Update: $$anonymous$$y trouble was corrupt drivers. uninstalling and re-installing never worked but a Universal ADB driver got my phone recognized by ADB. Hope that helps others save some time.
Answer by LargeVader · Jan 31, 2016 at 02:47 PM
Run the Terminal and enter to:
/Users/YourUserName/Library/Android/sdk/platform-tools
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
Answer by robinwood · Mar 28, 2016 at 02:47 PM
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: https://www.assetstore.unity3d.com/#!/content/44935
Enjoy it :)
Answer by elich11 · Apr 12, 2017 at 03:37 PM
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.
Answer by finologic · Aug 11, 2015 at 06:48 PM
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
Your answer
Follow this Question
Related Questions
ADB ActivityManager error! 0 Answers
internal profiler enabled 0 Answers
Crash problem on device but not in unity IDE 1 Answer
Google Play OBB and adb logcat help? 1 Answer