Search code examples
androideclipsedebuggingandroid-asynctaskadt

How do I use the Eclipse debugger in an AsyncTask when developing for Android?


I'm running ADT (Android Development Tools) in Eclipse and verified that my debugger is working by putting a breakpoint in MainMenu.oncreate (class Activity). But when I put it in the first line of my AsyncTask.doInBackground, it never hits it. I know it's running because I put a Log statement in the AsyncTask and it shows up in LogCat. Any help would be appreciated as I prefer the debugger over the logging.

My versions:

Eclipse SDK Version: 3.6.1  
Build id: M20100909-0800

alt text


Solution

  • Put the following code fragment in the beginning of doInBackground:

    android.os.Debug.waitForDebugger();

    Then when you set a breakpoint in that thread, eclipse will find it.