Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android attach debugger without running app

I inherited some code that is having an issue when importing files only when the app isn't running. I was wanting to see if there was a way to hookup/monitor an app before it runs and be able to step through code.

The problem only comes about when importing starts the app. I seen that I could use DDMS for debugging logcat and the heap but I need to be able to step through the code with the debugger... at least I think I do.

enter image description here

like image 579
Bryan Williams Avatar asked Feb 22 '13 20:02

Bryan Williams


2 Answers

In several latest API version (at least 21+), you can find:

Settings -> Developer options -> Wait for debugger.

which helps you stop for debugger during a debug application's startup

like image 110
Shubham Chaudhary Avatar answered Oct 12 '22 23:10

Shubham Chaudhary


Once the app is running you can go to DDMS processes and click the bug icon. If you need to do it right before early code is run, you could put a sleep in before that code to give you a chance to start debugging your process. But if this sounds like too much trouble, logging is probably a better option.

like image 35
Edwin Evans Avatar answered Oct 13 '22 00:10

Edwin Evans