开发者

Start debugging Android application right after reboot

开发者 https://www.devze.com 2023-04-12 13:27 出处:网络
Helo ! I am working right now with an application that uses BOOT_COMPLETED receiver. So if I want to debug this application with some breakpoints in its class, I have to reboot my 开发者_JAVA技巧pho

Helo !

I am working right now with an application that uses BOOT_COMPLETED receiver.

So if I want to debug this application with some breakpoints in its class, I have to reboot my 开发者_JAVA技巧phone and connect to it in the proper time, but I am always too late.

Have you got any better solutions how to debug my application exact when it starts its lifetime with device reboot case ?

Thanks !


You can wait for a debugger - Debug.waitForDebugger()


Close your emulator and Run the application directly in Debug and select the option to launch the emulator that you want to run it on.


It's an strange thing, but, what if you put a 20 sec pause or loop before your first break point?


In this case logging is better solution than debuggung. I was able to see logs arising from BOOT_COMPLETE processing even in IDEA logcat window. (I also do not value step by step debugging very much, and prefer TDD approach anyway)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号