简体   繁体   English

如何在Android中调试通过打开文件启动的应用程序?

[英]How to debug an application in Android, that is started by opening a file?

I would like to debug an application in Android when I open a file and choose open using my app (eg pdf file and my app is able to read pdf). 当我打开文件并选择使用我的应用程序打开(例如pdf文件且我的应用程序能够读取pdf)时,我想在Android中调试应用程序。 Is it possible? 可能吗?

I tried adding Thread.sleep to launcher activity and attaching debug to running process, but the app crashes. 我尝试将Thread.sleep添加到启动器活动并将调试附加到正在运行的进程,但是该应用程序崩溃。

Regards, Piotr 问候,皮奥特

You can use Debug.waitForDebugger(); 您可以使用Debug.waitForDebugger(); just before opening the file and attach a debbuger then. 在打开文件之前,然后附加一个调试器。

Look http://developer.android.com/intl/es/reference/android/os/Debug.html#waitForDebugger%28%29 外观http://developer.android.com/intl/es/reference/android/os/Debug.html#waitForDebugger%28%29

不要运行调试并将其附加到正在运行的进程中。直接调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM