为什么语音识别突然停止工作?
我的Android应用(Xamarin)使用语音识别。这在使用Android 8、11和12的智能手机上运行良好。由于几周,我的应用程序的语音识别已停止与Android 11(经过2种不同的智能手机测试)合作。 在Android 8 + 12下,它仍然可以正常工作! Gboard语音识别仍然在Android 11上有效。 我的智能手机上没有使用Android 11的更新,也没有更新我的应用程序。
OnResults
始终从secementrecognizer
带有以前的识别文本调用。现在,onResults
用空捆绑列出。 OnError
用segredRecognizerError.nomatch
调用。
如果我使用意图进行语音识别,则可以使用!如果我将语音识别器与相同的参数使用,则它不起作用。我必须使用语音识别器,因为我不希望应用程序中的Android对话框。
那么,使用语音识别器时有什么不同呢?
logcat:
With Intent only
04-29 12:25:07.004 24526 24672 I A : TTL (0 seconds) reached - destroy SODA
04-29 12:25:07.007 961 961 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: concurrency active 0, tx 0, rx 0, concurrency session_allowed 1
04-29 12:25:07.009 24526 24667 I A : Received a final result for a segment
04-29 12:25:07.009 24526 24667 I A : Received the final result for the recognition
04-29 12:25:07.010 24526 24690 I A : updated TranscriptionState: TranscriptionState{language=Deutsch (Deutschland), liveTranscription=# com.google.android.apps.search.transcription.f.ay@72c8abf5, finalRecognitionResults=# com.google.android.apps.search.transcription.f.o@c09c735a, hasStartOfSpeech=true, isMicOpen=true, appflowErrorStatus=null, speechLevel=0, audioUri=, lastAudioRationaleToastTimestampLoaded=false} for request-id 1191836547
04-29 12:25:07.010 1477 2981 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:25:07.010 24526 24526 I A : #setLatestRecognizedText stableText: Hallo, pendingText:
04-29 12:25:07.010 1477 27263 I SoundTriggerMiddlewareLogging: setCaptureState[this=com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl@51cdb90, caller=1041/1059](false)
04-29 12:25:07.010 24526 24690 I A : Offline recognizer - stop detection
04-29 12:25:07.014 1477 2981 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:25:07.014 1477 2981 I chatty : uid=1000(system) Binder:1477_14 identical 1 line
04-29 12:25:07.015 1477 2981 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:25:07.015 24629 24680 I A : AudioRequestListeningSession stop listening status: CLOSED
With SpeechRecognizer
04-29 12:28:07.216 24526 24690 I A : TTL (0 seconds) reached - destroy SODA
04-29 12:28:07.224 1477 2951 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:28:07.246 961 17127 D audio_hw_primary: disable_audio_route: usecase(10) reset and update mixer path: audio-record
04-29 12:28:07.247 961 17127 I soundtrigger: audio_extn_sound_trigger_update_stream_status: send event 12: usecase id 10, type 1
04-29 12:28:07.247 961 17127 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: concurrency active 0, tx 1, rx 0, concurrency session_allowed 1
04-29 12:28:07.247 961 17127 D sound_trigger_platform: platform_stdev_check_concurrency_supported: capture concurrency allowed, usecase type 1 voice_concur 0 voip_concur 0
04-29 12:28:07.247 961 17127 D audio_hw_primary: disable_snd_device: snd_device(84: voice-rec-mic)
04-29 12:28:07.251 961 17127 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: concurrency active 0, tx 0, rx 0, concurrency session_allowed 1
04-29 12:28:07.254 1477 2951 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:28:07.254 1477 5904 I SoundTriggerMiddlewareLogging: setCaptureState[this=com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl@51cdb90, caller=1041/1059](false)
04-29 12:28:07.260 1477 5904 I SoundTriggerMiddlewareLogging: setCaptureState[this=com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl@51cdb90, caller=1041/1059](false)
04-29 12:28:07.261 1477 8707 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:28:07.261 24629 24679 I A : AudioRequestListeningSession stop listening status: CLOSED
AndroidManifest.xml的一些细节:
android:versionCode="30"
android:targetSdkVersion="30"
android:minSdkVersion="22"
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
非常感谢,祝您有美好的一天,
My Android app (Xamarin) uses speech recognition. This has worked fine on smartphones with Android 8, 11 and 12. Since a few weeks the speech recognition of my app has stopped working with Android 11 (2 different smartphones tested).
It still works fine under Android 8 + 12! The Gboard speech recognition still works on Android 11.
There are no updates on my smartphone with Android 11 and also no updates of my app.
OnResults
was always called from SpeechRecognizer
with the recognized text before. Now, OnResults
is called with empty Bundle.OnError
is called with SpeechRecognizerError.NoMatch
.
If I use an Intent for speech recognition, it works! If I use the SpeechRecognizer with the same parameters, it does not work. I have to use the SpeechRecognizer because I do not want the Android dialog in my app.
So what is different when using SpeechRecognizer?
Logcat:
With Intent only
04-29 12:25:07.004 24526 24672 I A : TTL (0 seconds) reached - destroy SODA
04-29 12:25:07.007 961 961 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: concurrency active 0, tx 0, rx 0, concurrency session_allowed 1
04-29 12:25:07.009 24526 24667 I A : Received a final result for a segment
04-29 12:25:07.009 24526 24667 I A : Received the final result for the recognition
04-29 12:25:07.010 24526 24690 I A : updated TranscriptionState: TranscriptionState{language=Deutsch (Deutschland), liveTranscription=# com.google.android.apps.search.transcription.f.ay@72c8abf5, finalRecognitionResults=# com.google.android.apps.search.transcription.f.o@c09c735a, hasStartOfSpeech=true, isMicOpen=true, appflowErrorStatus=null, speechLevel=0, audioUri=, lastAudioRationaleToastTimestampLoaded=false} for request-id 1191836547
04-29 12:25:07.010 1477 2981 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:25:07.010 24526 24526 I A : #setLatestRecognizedText stableText: Hallo, pendingText:
04-29 12:25:07.010 1477 27263 I SoundTriggerMiddlewareLogging: setCaptureState[this=com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl@51cdb90, caller=1041/1059](false)
04-29 12:25:07.010 24526 24690 I A : Offline recognizer - stop detection
04-29 12:25:07.014 1477 2981 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:25:07.014 1477 2981 I chatty : uid=1000(system) Binder:1477_14 identical 1 line
04-29 12:25:07.015 1477 2981 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:25:07.015 24629 24680 I A : AudioRequestListeningSession stop listening status: CLOSED
With SpeechRecognizer
04-29 12:28:07.216 24526 24690 I A : TTL (0 seconds) reached - destroy SODA
04-29 12:28:07.224 1477 2951 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:28:07.246 961 17127 D audio_hw_primary: disable_audio_route: usecase(10) reset and update mixer path: audio-record
04-29 12:28:07.247 961 17127 I soundtrigger: audio_extn_sound_trigger_update_stream_status: send event 12: usecase id 10, type 1
04-29 12:28:07.247 961 17127 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: concurrency active 0, tx 1, rx 0, concurrency session_allowed 1
04-29 12:28:07.247 961 17127 D sound_trigger_platform: platform_stdev_check_concurrency_supported: capture concurrency allowed, usecase type 1 voice_concur 0 voip_concur 0
04-29 12:28:07.247 961 17127 D audio_hw_primary: disable_snd_device: snd_device(84: voice-rec-mic)
04-29 12:28:07.251 961 17127 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: concurrency active 0, tx 0, rx 0, concurrency session_allowed 1
04-29 12:28:07.254 1477 2951 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:28:07.254 1477 5904 I SoundTriggerMiddlewareLogging: setCaptureState[this=com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl@51cdb90, caller=1041/1059](false)
04-29 12:28:07.260 1477 5904 I SoundTriggerMiddlewareLogging: setCaptureState[this=com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl@51cdb90, caller=1041/1059](false)
04-29 12:28:07.261 1477 8707 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
04-29 12:28:07.261 24629 24679 I A : AudioRequestListeningSession stop listening status: CLOSED
Some details of AndroidManifest.xml:
android:versionCode="30"
android:targetSdkVersion="30"
android:minSdkVersion="22"
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
Thanks a lot and have a nice day,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此错误是Google App Update 13.16.8.23.arm64和一些意图参数的组合。
如果设置了以下参数
并
安装了最新的Google应用程序,则语音识别器将不起作用。
如果最新的Google应用程序被卸载(该应用程序将返回到较旧的版本),则语音识别器即使使用此参数也可以再次起作用。
如果从代码中删除了参数,则语音识别功能正常,即使使用了最新的Google应用程序。
This error is a combination of the Google app update 13.16.8.23.arm64 and some intent parameters usage.
If the following parameters are set
AND
the latest Google app is installed, the SpeechRecognizer will not work.
If the latest Google app was uninstalled (which will roll back to the older version), the SpeechRecognizer works again, even with this parameters.
If the parameters are removed from code, the SpeechRecognizer works fine, even with the latest Google app.
尝试从您的意图中删除以下一项或全部:
enveraizerIntent.extra_max_results ensunizerIntent.extra_speech_inpeech_input_complete_complete_silence_silence_silence_lenge_millis nisterizerIntent.extra
我的情况我必须删除所有'em,否则它将行不通
Try to remove from your intent one or all of the following:
RecognizerIntent.EXTRA_MAX_RESULTS RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS
In my case I had to remove all of 'em otherwise it would not work