For normal Activity, I can set some breakpoints and click F11 in Eclipse to debug. However, it is not working when I develop app widget. So, how can I debug?
Android Studio
I did not find a "structured" way to explicitly debug an App Widget.
My workaround:
Make sure you have an Activity in your project - usually you will have at least a Setting Activity, but if not, just make a dummy Activity that doesn't have to do anything.
In your Manifest, add this Activity and mark it as the launching activity:
now you should place your breakpoint wherever you like to debug, and launch your application using the button. Now the code of the whole application is under the debug session and the debugger will stop at any breakpoint, including the widget.
Note: before production, remove the launching intent filter from your manifest, if you don't mean for this Activity to be launched directly from the device launchpad