dors
dors

Reputation: 5872

Debug.waitForDebugger(); not working in Android studio

When I worked with Eclipse, I used Debug.waitForDebugger() to enter debug mode in hard to reach classes like services.

However, since I moved to Android Studio, I was not able to get Debug.waitForDebugger() to work. When I add it and run the app, it does not enter debug mode at all.

Does anyone know how to make Debug.waitForDebugger() work in Android Studio?

Upvotes: 3

Views: 3427

Answers (3)

Objectist
Objectist

Reputation: 61

Use the emulator/device entries under "Settings>Development Options" as advised here

Upvotes: 0

Nati Dykstein
Nati Dykstein

Reputation: 1290

Quoting from AOSP issue 76040 https://code.google.com/p/android/issues/detail?id=76040 -

"DDMS in Eclipse will monitor apps run on a device. When apps show up in ddms in "waiting-for-debugger" mode and the app name (its package) match the package of an app opened in the workspace, then ADT will automatically connect the debugger configured with that particular app.

We should do this in Studio as well. Probably after 1.0 though"

Up until today this problem has not been resolve yet in Android Studio.

Upvotes: 2

godot
godot

Reputation: 3545

try android.os.Debug.waitForDebugger();

Upvotes: 0

Related Questions