Check out the log functions here:

http://developer.android.com/reference/android/util/Log.html

You drop them in and around the functions you want to debug to output 
variables and status. Doing this helps you confirm in real-time that things 
are going well. There are times where you will not be able to debug the 
standard way and these will help a ton.

To use them, just pick which category you want the message to show up in 
LogCat and use that Log.x function. Put them before functions to validate 
you are sending in the correct arguments and you'll also know which 
file/string/object it is working on when it fails.

These are also great to put at the start of built-in functions like 
onCreate, onStart, onResume, etc. to watch the actual flow of your program. 
You can put them at the start of methods to let it tell you which methods 
it is calling and when to get a better understanding of how Android works. 
Add them to your most important functions (or all functions) and you'll 
have a beautiful picture of how exactly your code gets executed. It's great 
for optimizing.

Steven
Studio LFP
http://www.studio-lfp.com


On Friday, October 28, 2011 8:10:09 AM UTC-5, nester wrote:
>
> So I'm making progress on my first real android app (not hello world). 
> So far everything is going pretty smooth... except for debugging. I 
> just can't figure it out for the life of me! 
>
> I've been able to insert breakpoints and inspect, but when stepping 
> through code... it just seems to break. 
>
> Other times when I've made an error, I'll get a message on crash like 
> "File not found". Messages like this are completely useless... because 
> I can't tells WHICH FILE isn't found. So far I can't tell where the 
> hell it's breaking when it crashes. 
>
> I've used trace-cat a bit; but that seems better at high level system 
> processes, not granular line-by-line step through processes. 
>
> Trial & Error have gotten the job done so far... but as a native .Net 
> programmer, I know debug tools could be a LOT more useful. 
>
> I'm new to Eclipse; so I'm pretty sure this is just a learning curve. 
> Can anybody point me to a good debugging tutorial, or video? Do you 
> have any good tips on what I could be missing? 
>
> Thanks for the help.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to