Breakpoints inside SpeechRecognizer.java are ignored
Asked Answered
M

1

0

In my attempts to troubleshoot a android.speech.SpeechRecognizer.ERROR_CLIENT error in my app, I set breakpoints in SpeechRecognizer.java lines that invoke my listener's onError(), i.e. 9 lines containing:

mListener.onError(ERROR_CLIENT);

This is because there are 9 different reasons for this error, but they are invisible to my app, and the preceding Log.e(TAG, "cancel() failed", e); statement is nowhere to be seen on my Debug console.

Those breakpoints, however, are ignored.

I know for certain that those mListener.onError(ERROR_CLIENT); are called, because setting a breakpoint in my app's listener's onError on

case SpeechRecognizer.ERROR_CLIENT:

works!

AFAICR, it should be possible to place a breakpoint inside a library jar. What am I missing?

Is it possible to breakpoint inside SpeechRecognizer.java such that it breaks when reached?

(using Android Studio 2021.3.1 Patch 1)

In case the following brings up some insights, note the 69 errors in the original file from SDK 33: 69 errors in the original file from SDK 33

They are mainly due to unresolved symbols: mainly due to unresolved symbols

Mckeever answered 30/12, 2022 at 7:34 Comment(0)
M
0

Well, after some more experimentation, I discovered that placing a breakpoint inside SpeechRecognizer.java does break when reached:

Breakpoints inside a library jar do work

I did that by going down the stacktrace:

SpeechRecognizer error stacktrace

This tells me that the elusive Log.e(TAG, "cancel() failed", e); perhaps never gets called. But that is a different issue.

In the meanwhile, it looks like the only way to tell which of the 9 candidates for ERROR_CLIENT is the root cause, would be to spot and track the stacktrace thrown by a NetworkSpeechRecognizer exception:

W  Recognizer network error 
    at com.google.android.apps.speech.tts.googletts.service.GoogleTTSRecognitionService.onCancel(PG:6)
    at android.speech.RecognitionService.dispatchCancel(RecognitionService.java:185)
    at android.speech.RecognitionService.-$$Nest$mdispatchCancel(Unknown Source:0)
    at android.speech.RecognitionService$1.handleMessage(RecognitionService.java:110)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Mckeever answered 3/1, 2023 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.