Breakpoint in service not working

可紊 提交于 2019-12-22 05:58:13

问题


I am trying to add a breakpoint to a service running on a separate thread. No matter where I place the breakpoint in the service, they are always ignored.

I am sure that the service is running as I see the Log.e in the logcat. My debug mode is also correctly used as any breakpoint in the main thread of the app works.

Am I missing something? Is debug mode not supported for services in a separate thread?

I just updated Eclipse and Android SDK tools to the latest versions today.

I am testing my application on a device.


回答1:


The android.os.Debug.waitForDebugger() did the trick. Add this before the line of code you want to debug.




回答2:


Make sure that you declare the package name in the service tag in the manifest using android:process attribute, for example:

<service android:name=".YourCoolService"
            android:process="your.package.here"/>


来源:https://stackoverflow.com/questions/13562011/breakpoint-in-service-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!