调试没有启动器的应用 Activity
Debugging an App that does not have a launcher Activity
我当前的应用程序没有任何活动。它基本上是一堆没有 activity 启动器的服务 android 组件( 就像标题所说 )。基本上它是通过来自 Android OS.
的广播接收器自动触发的
我很难将我的调试器附加到我的 android 进程来调试应用程序。
知道如何强制调试器附加到应用程序吗?
您可以为此使用 Debug.waitingForDebugger() 实用方法。
来自文档:
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.
找到罪魁祸首。除了@Edson 的建议之外,我忘记在我的构建类型上设置 debuggable true
,因为它默认设置为 false
。现在它的工作!
我当前的应用程序没有任何活动。它基本上是一堆没有 activity 启动器的服务 android 组件( 就像标题所说 )。基本上它是通过来自 Android OS.
的广播接收器自动触发的我很难将我的调试器附加到我的 android 进程来调试应用程序。
知道如何强制调试器附加到应用程序吗?
您可以为此使用 Debug.waitingForDebugger() 实用方法。
来自文档:
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.
找到罪魁祸首。除了@Edson 的建议之外,我忘记在我的构建类型上设置 debuggable true
,因为它默认设置为 false
。现在它的工作!