3

I'm failing to debug my Android app. I have set a breakpoint in the onCreate() method of an app, and starts the app in debug mode from Eclipse. The debugger successfully connects and the application and the device freezes at the point where I have set the breakpoint, but Eclipse does not give focus to the code line where it has paused.

The Run menu has all debug commands greyed out (step over, step into etc). I have opened the DDMS perspective and can see that the debugger is successfully connected. I can find my process there and stop it, and it gives the expected result on the phone. I have also tried all suggestions from this thread to no avail, but then again it tries to solve a different problem (not connecting).

Any suggestions?

more info: I have tried also the follwoing:

  • Uninstalling the app from the phone.
  • Rebooting the phone.
  • Restarting ADB.
  • Restarting eclipse
  • Rebooting the computer

Operating system is Windows 8. Eclipse version Juno. I have successfully debugged only days ago so there must be something I did that made this stop working.

Community
  • 1
  • 1
Nilzor
  • 18,082
  • 22
  • 100
  • 167
  • Did you set the debugable attribute in the Manifest? – Blackbelt Mar 08 '13 at 13:04
  • yes. I have also added the 'android.permission.SET_DEBUG_APP` permission. – Nilzor Mar 08 '13 at 13:05
  • do you have only one instance of eclipse runnning? – Blackbelt Mar 08 '13 at 13:06
  • Only one instance of Eclipse. – Nilzor Mar 08 '13 at 13:12
  • Question updated with OS and Eclipse version – Nilzor Mar 08 '13 at 13:14
  • are you sure the debugger is connected ? If you open the debug perspective could you see the process you are trying to debug? – Blackbelt Mar 08 '13 at 13:16
  • Are you sure you are setting the breakpoint in onCreate() ? Some areas of the code (like services) are NOT debuggable in eclipse by default. Can you try adding the line android.os.Debug.waitForDebugger(); to your code ? It specifically waits for the debugger to connect before executing further code. – Deepak Bala Mar 08 '13 at 13:16
  • blackbelt: yes I can see the process and stop it. @deepak-bala I tried that now to no avail. I also tried moving the breakpoint to an onClick()-method, and then the Activity rendered correctly but froze when I clicked the button. – Nilzor Mar 08 '13 at 13:23
  • Have you finally resolved this problem? I'm facing exactly the same issue - it worked a few days ago, now when I click a button in handler for which I have a breakpoint, app hangs. No breakpoint - it works. – DimaA6_ABC Jan 12 '14 at 21:04
  • Yes but I can't remember exactly what I did. I think i might have started a new, clean workspace. – Nilzor Jan 13 '14 at 07:49

1 Answers1

1

Try going to the "Devices" View (Window > Show View > Devices).

In it, search for the process of your application, select it, and click at the enter image description here button.

After that, run your application in the debug mode.

Renato Lochetti
  • 4,558
  • 3
  • 32
  • 49
  • The process is not running. Shall I start it from the phone? – Nilzor Mar 08 '13 at 13:28
  • Actually the process then starts in debug mode, so clicking the debug icon the states "The process is already being debugged". Triggering the breakpoint then yields the same result - the process freezes but Eclipse is not able to give me control over the execution – Nilzor Mar 08 '13 at 13:29
  • Just one thing: You are debugging on a real device, right? On the "Developer Options" at "Settings" have you checked the "USB debugging" option? – Renato Lochetti Mar 08 '13 at 13:33
  • yes and yes. I have successfully debugged against this device from Eclipse only days ago. – Nilzor Mar 08 '13 at 13:38
  • Weird. If you try to debug the application on a virtual device, does it work? – Renato Lochetti Mar 08 '13 at 13:40
  • same for me here with eclipse Luna – L.Grillo Jul 04 '14 at 20:15