Debugging not working in a service class ?? what can cause this issue?

半腔热情 提交于 2019-12-23 19:07:07

问题


All of a sudden I am not able to debug anything that i am doing in a service even though i put breakpoints all over. but logging shows that all the lines are getting executed. Can someone tell me what could be causing this issue. I am using eclipse and i have set to "Build automatically".


回答1:


Do you have an Activity which is launched at the beginning of your application?

If not you have to manually activate the debug on your process by using the DDMS tool in Eclipse.

In DDMS -> Devices, check your process (the line contains the package name of your app), select it and then click on the debug button. A debug icon will appear near your process, then you should be able to use breakpoints in your Service.




回答2:


If you are using a Runnable try placing this in the run() method:

android.os.Debug.waitForDebugger();


来源:https://stackoverflow.com/questions/5379129/debugging-not-working-in-a-service-class-what-can-cause-this-issue

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