How to Debug Android application line by line using Eclipse?

AndroidEclipseDebugging

Android Problem Overview


I am familiar with VS.Net IDE & it has a lot of support for debugging. But the android development is something new for me. I am using the Eclipse IDE. I was wondering how to debug the android application line by line just like we can do in .Net IDE?

Currently i am using the log window, but i am not happy with it. I need suggestion from the expert guys, what is the best way to debug the Android application using Eclipse?

Great thanks for your valuable time & help.

Android Solutions


Solution 1 - Android

  1. either start the app by right clicking on the project and select Debug As->Android Application or by running it normally and later in the DDMS perspective select the running app in your devices pane and click on the green bug.

  2. once a breakpoint has been hit you can step over (f6) or step into (f5) (check the Run menu for more commands).

Solution 2 - Android

Solution 3 - Android

Put a breakpoint on the line you want to start debugging from, then Run the Application in Debug mode, the app will hit the breakpoint and then you can go through it just like in VS.

Solution 4 - Android

I just set up the Eclipse included in the Android Development Tools (ADT), the adt-bundle-mac-x86_64-20131030 version. Setting the property in the manifest file gave me a warning saying that it would be better to set up different Run and Debug configurations. It turns out that I simply needed to create a debugging profile:

  1. Run >> Debug Configurations...
  2. Click "Debug" to take the defaults

Now you can go to Run >> Debug to run on the device. (Assuming that the device has debugging enabled, of course)

If you are an Eclipse or ADT developer and are reading this, I strongly suggest that Eclipse create a debugging configuration by default.

Solution 5 - Android

There are two methods. First you can debug the app from starting.You can do it by Right click on your project->Debug as Android Application.

In second method,you can debug the any activity without restarting the complete app. You can do it so by:-

  1. Go to DDMS

[![enter image description here][1]][1]

  1. Now click on small mobile icon with +sign on the bottom tab.

[![enter image description here][2]][2]

  1. Now click on devices. After that list of devices will be showed up with the list of projects.Click on the required project.And click on green colour debug option.Your debug mode is started now.

[![enter image description here][3]][3]

F3 to go inside a function. F6 for the next line and F8 to go to the next break point. [1]: https://i.stack.imgur.com/atfXx.png [2]: https://i.stack.imgur.com/3G9Ul.png [3]: https://i.stack.imgur.com/6839G.png

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionYaqub AhmadView Question on Stackoverflow
Solution 1 - AndroidP.MelchView Answer on Stackoverflow
Solution 2 - AndroidYaqub AhmadView Answer on Stackoverflow
Solution 3 - AndroidmbwasiView Answer on Stackoverflow
Solution 4 - AndroidprewettView Answer on Stackoverflow
Solution 5 - AndroidAnshul AggarwalView Answer on Stackoverflow