Where and how runtime error logs are saved in Android device?
While debugging, Log.d() or Log.e() methods come to LogCat, but how do I capture the runtime error or trace log on the Android device when it is not connected to the development enviro开发者_JAVA百科nment ?
Works only for rooted phones...They work by executing logcat
utility and capturing the stdout
(OutputStream
). But to execute the logcat
utility, you need root rights....
There are more utilities, but here's a sample from OpenIntents
...
Logcat reader
It is not saved in your android device when adb is not connected to the developent environment, but you can save your runtime logs in a file
I have tried this and its working for me:: :)
To get the trace/issue logs user has to follow below steps:
1) First, user will be needing to DOWNLOAD AND INSTALL Google Android SDK program along with the Android USB drivers. User can download the Android SDK drivers from here :
"http://developer.android.com/sdk/index.html" ( To get started, download the appropriate package from the table above, then read the guide to Installing the SDK :
"http://developer.android.com/sdk/installing.html") and USB drivers for Windows operating system from here : "http://dl.google.com/android/android_usb_windows.zip".
Installed the Android SDK to PC if not available.
2) Connect the Android device to the PC using USB.
3) Open the Command Prompt ( Terminal on MAC ) and go to the SDK/tools path on prompt (e.g. xyz-Devlop:tools username$, on my mac machine), then execute the
"./adb logcat" on MAC and "adb logcat" on Windows, command on Command Prompt (e.g. xyz-Devlop:tools username$ ./adb logcat, on my mac machine).
4) Run the application on device.
Logs will be then available in the Command Prompt/Terminal.
Enjoy Coding/Debugging...... :)
精彩评论