user2566468
user2566468

Reputation: 179

Trouble and frustration with the Android debugger

So far I bought a half dozen Android books and yet couldn't find one that talks about debugging in a reasonable depth other than just scratching the surface.

I'm getting really frustrated about the fact that the debugger, when finds a problem, some times shows you the line in your code where the problem is happening and other times it just shows the "source not found" error in the class file editor. (I attached the screen-shot below).

When the debugger shows the line (in your code) where the execution stops it is clear to understand what's happening and easy to figure out what the problem is.

But when you get the "source not found" message it's really hard to figure where the problem is happening, don't even know where to start and I have to put breakpoints all over the place until I can reduce the area and pin point the problem.

Doing it that way is really... really... time consuming, what should I do when the "source not found" appears, where do I get a clue of the location of the problem? Is there some view or something else that I'm missing? How do you guys do it when that happens? Thanks in advance.

Screenshot from Eclipse ADT

Upvotes: 3

Views: 70

Answers (1)

Gabe Sechan
Gabe Sechan

Reputation: 93561

The line will always be printed in the logcat. Just hit run until it stops breaking, and check the logfile. It gives the complete stack trace there.

Ok, I'm going to be the geeezer jerk for a minute. A debugger is a crutch. Your first reaction as a programmer should always be to check the log file. The log file will generally give context, and you won't always be able to run a debugger (you're running on an interrupt, the code is running on a remote machine you don't have access to, the code is running a language that doesn't have exceptions, the crash is a hard crash and brings down the computer, etc). Checking the debugger should be step 3 or 4, not step 1.

Upvotes: 2

Related Questions