The application has stopped unexpectedly: How to Debug?

102,351

Solution 1

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.

Solution 2

Filter your log to just Error and look for FATAL EXCEPTION

Solution 3

If you use the Logcat display inside the 'debug' perspective in Eclipse the lines are colour-coded. It's pretty easy to find what made your app crash because it's usually in red.

The Java (or Dalvik) virtual machine should never crash, but if your program throws an exception and does not catch it the VM will terminate your program, which is the 'crash' you are seeing.

Share:
102,351
Android Eve
Author by

Android Eve

Just starting in the world of Android development... New to Java and Eclipse as well.

Updated on February 25, 2020

Comments

  • Android Eve
    Android Eve about 4 years

    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?