I am investigating some issues which happen during my app's startup process, but DDMS won't start the debug mode until the process has started, is there a way I can capture the events earlier?
You usually start a debugging session using the Debug button or menu option. However, if you started an app by running it, you can attach a debugger to the running app without needing to restart it. To do this, click Attach Debugger to Android Process.
I know that this is a couple of years late, but for any future searches:
Putting WaitForDebugger
into your code is one way.
Unlocking developer options (by tapping on the build number in system information on the android device) in Settings allows us to select an application for debugging and then opt to wait for a debugger whenever the program is launched. This allows us do the equivalent of adding and removing WaitForDebugger
without modifying and reinstalling the code each time.
For Android Studio, here is what worked for me:
android.os.Debug.waitForDebugger();
Where you want to start debugging.
Once it's up, attach the debugger:
Start debugging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With