12

It is easy to debug Android applications as most of them launch an activity and keeping breakpoint is all it takes. How to debug a GDK based google glass app as the service is triggered on voice and does not explictly launch an activity on install?

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
sivag1
  • 4,734
  • 3
  • 32
  • 35

2 Answers2

25

Same way any Android service is debugged. Just add the below line anywhere in the code and any breakpoint in the code after this can be used to stop the run.

android.os.Debug.waitForDebugger();

Thanks to this - http://www.helloandroid.com/tutorials/how-debug-service

sivag1
  • 4,734
  • 3
  • 32
  • 35
0

I tried to debug a sample GDK app with this option, but it doesn't help. I'm not sure if this option helped anyone to debug the GDK app. However the log.d function logs the message in console window. My expectation is to debug the flow to intercept variable values and modify during the flow.

* Updated * After activating DDMS perspective, I got the debug focus to code window to do the step by step walk-thru. However the glass goes to the standby mode very quickly and it blocks debugging activity. Trying to find the best practice. Will keep this thread posted. Stay tuned!

Acarin
  • 57
  • 6
  • Yes it helped me, this way. What challenge are you facing? Where are you keeping break point? More details appreciated. – sivag1 Dec 17 '13 at 18:31
  • Glass throws an ANR and kills the debugger quickly if you stop at a breakpoint on the main thread. So - either debug quickly, or move code out of the main thread. – kolosy Jan 03 '14 at 16:00