Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The application has stopped unexpectedly: How to Debug?

Tags:

Please note, unlike many other questions having the subject title "application has stopped unexpectedly", I am not asking for troubleshooting a particular problem.

Rather, I am asking for an outline of the best strategy for an Android/Eclipse/Java rookie to tackle this formidable task of digesting huge amounts of information in order to develop (and debug!) a simple Android application.

In my case, I took the sample skeleton app from the SDK, modified it slightly and what did I get the moment I try to run it?

The application (process.com.example.android.skeletonapp) has stopped unexpectedly. Please try again.

OK, so I know that I have to look LogCat. It's full of timestamped lines staring at me... What do I do now? What do I need to look for?

Is there a way to single-step the program, to find the statement that makes the app crash? (I thought Java programs never crash, but apparently I was mistaken)

How do I place a breakpoint?

Can you recommend an Android debug tutorial online, other than this one?

like image 327
Android Eve Avatar asked Feb 23 '11 23:02

Android Eve


People also ask

How does Logcat help in debugging Once the application has crashed?

Reading with logcat Once you are able have the steps to reproduce the crash, you can use a tool like logcat to get more information. The logcat output will show you what other log messages you have printed, along with others from the system.


1 Answers

I'm an Eclipse/Android beginner as well, but hopefully my simple debugging process can help...

You set breakpoints in Eclipse by right-clicking next to the line you want to break at and selecting "Toggle Breakpoint". From there you'll want to select "Debug" rather than the standard "Run", which will allow you to step through and so on. Use the filters provided by LogCat (referenced in your tutorial) so you can target the messages you want rather than wading through all the output. That will (hopefully) go a long way in helping you make sense of your errors.

As for other good tutorials, I was searching around for a few myself, but didn't manage to find any gems yet.

like image 192
HappyCodeMonkey Avatar answered Oct 04 '22 03:10

HappyCodeMonkey