Start debugging Android application right after re

2019-05-16 07:42发布

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 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 !

4条回答
Lonely孤独者°
2楼-- · 2019-05-16 08:23

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.

查看更多
We Are One
3楼-- · 2019-05-16 08:27

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)

查看更多
别忘想泡老子
4楼-- · 2019-05-16 08:38

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

查看更多
霸刀☆藐视天下
5楼-- · 2019-05-16 08:43

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

查看更多
登录 后发表回答