views:

199

answers:

4

When I are using Java we put System.out.println() for identifying errors, where it went wrong.

A very naive method.

With android, I cannot even use this method to isolate why the app crashed.

With Rails we would read the log file.

But as I am new to Java and android, I don't know which is the best practice. I believe there is a best practice, but I don't know what it is, and I couldn't formulate a good query to google around.

Pls help me, error check android.

+2  A: 

use logcat.

For more information on how to debug refer this tutorial

Samuh
That worked...thanks Samuh.
Sumit M Asok
+1  A: 

Use LogCat, you can lookup its method on the Android Dev Guide to see which one works for you. I chose verbose so my debug statements look like

Log.v("MyAppName", "Inside my function now, its so dark");

To show the content go to Window -> Show Views -> Other... -> LogCat and watch for where your errors occur.

NOTE: I am on my phone and could not provide the link for you and the path to view LogCat may not be 100%, my apologizes

Anthony Forloney
Your answer itself is help...no need of apologies...i thank you for the answer.
Sumit M Asok
+1  A: 

You can also view the debug info created by Log.x(tag, yourString) (where x is the type of output, v = verbose, d = debug, e = error etc) using ddms, which will also highlight the different types of output differnt colors, very useful!

Dori

Dori
+1  A: 

Use logcat, but if it "Works on My Machine" and its on the marketplace you can have users install "Log Collector" and then have them email you the log if you have a user who is willing to help troubleshoot the problem. Then you can read your logcat outputh and the exception details in the log they send to you (which is from their phone).

Donn Felker