Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Debugging with Eclipse - No Breakpoints

I am trying to debug a simple Android application on either the emultor or a device and I cannot get the debugger to stop on any breakpoints I have set. I have combined the other posts here and throughout the web and tried all the suggestions (Add debuggable:"true" to the manifest, stop and start adb, Clean all, make sure I use the debug button not the run button, etc etc). In the Debug perspective I can see the threads and in DDMS it shows the debug icon next to the device I am debugging on. I do see the blue dots where I set the breakpoint and the Debug perspective lists them and says they are active.

I have put in alerts just before the breakpoints to verify the code is getting executed.

Starting to go crazy here. Any other suggestions? I must be missing something simple but non-obvious.

UPDATE: I appreciate the responses so far. Unfortunately they have not solved my problem. I have followed the instruction on debugging and have debugging turned on in the phone. Also, I do see the "Waiting for debugger" alert on the phone when starting. In general everything says I am debugging (including getting logcat output that I have added). It just will not stop on breakpoints that I have added and are listed in the breakpoints tab in the Debug perspective. Also just to reiterate - this happens when debugging on the device as well as on the emulator. One thing I do notice is that when I launch the debugger I have it set to bring up the Android Device Chooser. In there the "debug" column is blank for my device - but if the emulator is running the debug column does say 'Yes'. Also the console states that is attempting to connect to the debugger. Should there be a console log that states that the debugger successfully connected? I do not see this.

UPDATE 20120914: I have been away from this for some time and had given up previously. Back to try and tackle this. It is still not resolved. Everything above is still current - but one other thing I have noticed. I set a Class Load Breakpoint on the main activity and it does stop there. It just does not stop at any Line Breakpoints. I have just updated to the latest JDK 1.7.0_07, Android SDK 20, ADT Plugin 20.0.3. I have used the logcat to output a message and set a breakpoint on this line. I see the message in logcat so I know the code is being executed. The debug window in the debig perspective also does show the android application with a number of threads beneath it and the Devices window in the DDMS perspective shows the application with the green bug icon next to it.

One more thing - when the debugger is running the line breakpoints bullets do not get a checkmark overlaid on them (the Class Load Breakpoint does!). I am guessing this is the root cause - but I don't know why they are not getting this. (By the way skip breakoints is also not set - breakpoints do not have lines through them).

Any new suggestions would be appreciated. I have burned a lot of time on this. It must be something obvious that I am not seeing.

like image 475
user1429628 Avatar asked Jun 01 '12 00:06

user1429628


People also ask

Why breakpoints are not working in Eclipse?

The solution was to enable it again, start a debug session, the breakpoint is hit and shown in the UI, then disable again the option. There is also another simpler way that will make Eclipse show the debugging highlight at the breakpoint or rather refresh the debugging UI to work as it should.

How do I enable debug breakpoints in Eclipse?

Breakpoints To define a breakpoint in your source code, right-click in the left margin in the Java editor and select Toggle Breakpoint. Alternatively, you can double-click on this position. The Breakpoints view allows you to delete and deactivate Breakpoints and modify their properties.

How do I skip breakpoints in Eclipse?

Eclipse define one command "skip all breakpoints", but no "enable all breakpoints". We can just change "skip all breakpoints" command to "toggle all breakpoints". Now we can map "toggle all breakpoints" to shortcuts and use it to enable and disable all breakpoints.

Why are my breakpoints not working?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.


1 Answers

Now I feel a bit stupid writing this post. But I resolved my issue finally. The problem is you cannot set breakpoints in the Javascript code. The part I left out unintentionally is I am writing an app for Android using PhoneGap. Almost all the code is Javascript. I am so used to developing .NET web apps in Visual Studio I just assumed you could set breakpoints in the javascript code. Breakpoints in the Java code happen to work fine. Anyway, Thanks for any suggestions. Do';t know if there are other .NET developers trying PhoneGap development - but maybe this post will help them.

like image 66
rcp Avatar answered Oct 22 '22 09:10

rcp