1

I was trying to run my new app after installing it on my mobile but instead i get to read this-

The Application MyApp has stopped unexpectedly.Plz try again.

After googling for some time i came to know i can debug my app using DDMS, so i connected my Android Mobile running with os 2.2.2 with ddms in my windows lappy but that how far i can go.

Now I want to know how i can check which step in my application's code is causing this problem
so plz provide step-by-step guide on how to do that.

Mohit
  • 1,045
  • 4
  • 18
  • 45

2 Answers2

3

First select Debug perspective as:

enter image description here

Then set Breakpoints at places you want:

enter image description here

After that create a Debug configuration via Debug As->Debug Configurations... and then Debug as Android Application as shown below: enter image description here

Then in Debug perspective you can trace/watch value of your desired variable by pressing F8: enter image description here That's it, you can also evaluate expressions through Expressions view. If it is not enabled select it from: Window->Show View->Other->Debug->Expressions.

Imran Rana
  • 11,899
  • 7
  • 45
  • 51
  • thnx for the input, but im using netbeans.....so is there a way to debug via netbans or atleast DDMS?!! – Mohit May 31 '12 at 02:31
0

I am not entirly sure how you can use DDMS to debug. However, the easiest way I have found is simply chucking load of log into your code, this then allows you to break it down and pin point exactly where your project is breaking. You can use code simlar to below:

Log.d("ID","VALUE TO PASS");

If you would like to pass something which is not a string, such as an int or outcome of a ceratin function you can use:

Log.d("ID", String.valueOf(int));

You can then view all these log in your LogCat, which can be found in 'Window - Show view - LogCat'. Hope this helps with your debugging issues.

SingleWave Games
  • 2,618
  • 9
  • 36
  • 52