[置顶] android.os.Debug.waitForDebugger() 引发的问题

最近开发过程中用到了Service ,需要对Service内的程序逻辑进行断点调试,遂加了android.os.Debug.waitForDebugger();这句代码。


出现问题:一切正常后,打包测试,发现只要手机连上电脑通过Eclipse直接运行程序就一切正常,而安装打包后的程序运行时,发现有的手机运行有的正常,有的不正常(只执行到onCreate()方法,并且Server会一直重启......),纠结了好久。。。最后发现这句该死的代码。。。


方法注释如下:

Wait until a debugger attaches. As soon as the debugger attaches, this returns, so you will need to place a breakpoint after the waitForDebugger() call if you want to start tracing immediately.


解决办法:在不需要调试时候,务必去掉这句代码。





邮箱[email protected]

微博:http://weibo.com/u/3209971935

你可能感兴趣的:([置顶] android.os.Debug.waitForDebugger() 引发的问题)