Question

I am beginner of android.I did not understand android LogCat.Please help me.

LogCat have seven column.How do work this every column (Level, Time, PID, TID, Application, Tag, Text) please tell me.

please give me some explanation this error. what is work column( FATAL EXCEPTION: main || at android.view || at android.os)
Sample error:

04-09 17:55:09.033: I/Choreographer(27247): Skipped 31 frames!  The application may be doing too much work on its main thread.
04-09 17:55:09.132: D/gralloc_goldfish(27247): Emulator without GPU emulation detected.
04-09 17:55:10.443: I/Choreographer(27247): Skipped 66 frames!  The application may be doing too much work on its main thread.
04-09 17:55:10.683: D/dalvikvm(27247): GC_FOR_ALLOC freed 74K, 8% free 2573K/2796K, paused 34ms, total 40ms
04-09 17:55:10.773: D/AndroidRuntime(27247): Shutting down VM
04-09 17:55:10.783: W/dalvikvm(27247): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
04-09 17:55:10.803: E/AndroidRuntime(27247): FATAL EXCEPTION: main
04-09 17:55:10.803: E/AndroidRuntime(27247): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.view.ViewRootImpl.setView(ViewRootImpl.java:571)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:246)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.app.Dialog.show(Dialog.java:281)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.app.ProgressDialog.show(ProgressDialog.java:116)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.app.ProgressDialog.show(ProgressDialog.java:99)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.app.ProgressDialog.show(ProgressDialog.java:94)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at com.example.shikkok_services.MainActivity$2.onClick(MainActivity.java:27)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.view.View.performClick(View.java:4204)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.view.View$PerformClick.run(View.java:17355)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.os.Handler.handleCallback(Handler.java:725)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.os.Handler.dispatchMessage(Handler.java:92)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.os.Looper.loop(Looper.java:137)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at android.app.ActivityThread.main(ActivityThread.java:5041)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at java.lang.reflect.Method.invokeNative(Native Method)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at java.lang.reflect.Method.invoke(Method.java:511)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-09 17:55:10.803: E/AndroidRuntime(27247):    at dalvik.system.NativeStart.main(Native Method)
Was it helpful?

Solution 2

See this link to understand DDMS and logcat better

and

I always look in the log cat from top to down and am looking for the first line that says at MYCLASS this is the last spot that the error occurred.

OTHER TIPS

Level: There are five types of level in LogCat

Log.i: this is an informational message

Log.v: Verbose

Log.d: Debug

Log.e: Error

Log.w: Warning

PID: Process ID

TID: Thread Id

Application: Application name

TAG: TAG is a user-defined string variable (e.g., static final String TAG = "debug";)

Text: Error text Check here for more.

In android you can use log to understand your code execution here are the differences:

  • Log.e: This is for when bad stuff happens. Use this tag in places like inside a catch statment. You know and error has occurred and therefore you're logging an error.

  • Log.w: Use this when you suspect something shady is going on. You may not be completely in full on error mode, but maybe you recovered from some unexpected behavior. Basically, use this to log stuff you didn't expect to happen but isn't necessarily an error. Kind of like a "hey, this happened, and it's weird, we should look into it."

  • Log.i: Use this to post useful information to the log. For example:
    that you have successfully connected to a server. Basically use it to report successes.

  • Log.d: Use this for debugging purposes. If you want to print out a
    bunch of messages so you can log the exact flow of your program, use this. If you want to keep a log of variable values, use this.

  • Log.v: Use this when you want to go absolutely nuts with your
    logging. If for some reason you've decided to log every little thing in a particular part of your app, use the Log.v tag.

you can use them, they help you trace your code, and find where does it crashed! or something else.

example:

Log.i("your tag" , "your text");


whene this line execute in your code, it will be printed in your logCar and you can see it.


Hope It helps You

general the only three parts of the log cat you need to look at are

application(the app that threw the error)

Tag(you can set the tag in certain circumstance to see where your error is hiding, or it will be set already to the part of the android system that threw the error)

Text( this will show the actual error along with the line numbers effected in your code)

as for your question about that particular error, we would need to see all the lines in the error to id it,( its usually a red block of messages)

final i will leave you with this....

Log.d("Tag", "Text");

put this anywahere in your code, and change the tag to your name, and the text to your activity name, then run the program. when it reaches the above code, it will print your message to the log cat.... its a good way to know where your at in your code when you crash, by which log tag is closest in the logcat

(you may need to import log)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top