- Home /
debugging android
hi , I'm building a program on android , I'm new to unity and I'm trying just to debug and show some simple messages on the console . I have written Debug.Log("hello world"); on my update function and attached it to my object . I don't see any errors and think it should show the message but it doesn't work . I have checked the "development build" and "script debugging" on the build window, and I'm testing my program on my android device . any suggestions on how to make it work?
thanks
Answer by Meltdown · Oct 10, 2011 at 06:08 PM
Use logcat profiler. Enable it under the player settings. Logcat is a part of adb.exe under the Android SDK \platform-tools folder.
To run it you can use the following commands...
adb logcat (begins logging)
adb logcat -c (clears the log)
adb logcat > yourlog.txt (dumps the log to a textfile called yourlog.txt)
EDIT : Remove the http:// Unity answers puts it there for some reason :/
adb logcat -help (help on all the command line options)
So before you start building your game, run adb logcat, you will see text being outputted to the command line window. Once you are all done, you can dump it to a file to read.
EDIT : An even better way to debug is using Eclipse. It's an IDE for Android, and gives you a grid-like GUI to view and filter your Android device logs. Read more about it at http://developer.android.com/sdk/installing/installing-adt.html It is far superior to logcat and well worth installing.
For those who upgraded an older Android SD$$anonymous$$: Note that the adb tool has been moved to the platform-tools folder within the android SD$$anonymous$$ installation folder (it used to be in the tools folder before).
Answer by MortePCAndVR · Jun 22, 2017 at 12:55 AM
Eclipse is now "eclipsed" by obsolesence, replaced by Android Studio. The Android Studio feature "logcat monitor" via adb works very well. Android Studio is a 1.9Gb download, (not including Android SDK/AVD/tools) but given the filtering options (filter by "unity"), it is a vast improvement on attempting a regex on adb logcat commandline output, and does not require you to have only one adb device connected or to disconnect the usb cable when you have done an adb tcpip 5555 adb connect xx.xx.xx.xx for Android unity debugging.