Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example doesn't work on Samsung Galaxy S7 SM-G930F #36

Closed
cristianrablau opened this issue Feb 16, 2020 · 23 comments
Closed

Example doesn't work on Samsung Galaxy S7 SM-G930F #36

cristianrablau opened this issue Feb 16, 2020 · 23 comments
Labels
android bug Something isn't working documentation Improvements or additions to documentation

Comments

@cristianrablau
Copy link

cristianrablau commented Feb 16, 2020

Hello,

The example provided here doesn't work on my Samsung Galaxy S7 SM-G930F(Android 8.0.0). When I press the Start button and speak there is no recognized word or error shown.

I suppose the example should work on my device, so do you have any idea how could I find the source of the problem?

Update: I was able to test the same app on a Samsung Galaxy A5 2016 SM-A510F(Android 7.0) and the recognition works on that device.

@sowens-csd
Copy link
Contributor

Yes, it should definitely work on that device. Is there any log output with more information?

@cristianrablau
Copy link
Author

There was nothing that I noticed. I will post an entire log soon.

@cristianrablau
Copy link
Author

`PS E:\git\Flutter\stt_test> flutter run
Launching lib\main.dart on SM G930F in debug mode...
Picked up _JAVA_OPTIONS: -Xverify:none
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 6,5s
√ Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk... 22,7s
D/FlutterActivity(23441): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate(23441): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate(23441): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
W/FlutterEngine(23441): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@c8e9b9f) but could not find and invoke
the GeneratedPluginRegistrant.
D/FlutterActivityAndFragmentDelegate(23441): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView(23441): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@c8e9b9f
D/FlutterActivityAndFragmentDelegate(23441): Executing Dart entrypoint: main, and sending initial route: /
D/libGLESv2(23441): STS_GLApi : DTS, ODTC are not allowed for Package : com.example.stt_test
D/SpeechToTextPlugin(23441): Start initialize
D/SpeechToTextPlugin(23441): Checked permission
D/SpeechToTextPlugin(23441): has permission, completing
D/SpeechToTextPlugin(23441): completeInitialize
D/SpeechToTextPlugin(23441): Creating recognizer
D/SpeechToTextPlugin(23441): Setting listener
D/SpeechToTextPlugin(23441): before setup intent
D/SpeechToTextPlugin(23441): setupRecognizerIntent
D/SpeechToTextPlugin(23441): In RecognizerIntent apply
D/SpeechToTextPlugin(23441): put model
D/SpeechToTextPlugin(23441): put package
D/SpeechToTextPlugin(23441): put partial
D/SpeechToTextPlugin(23441): after setup intent
D/SpeechToTextPlugin(23441): sending result
D/SpeechToTextPlugin(23441): leaving complete
D/SpeechToTextPlugin(23441): leaving initializeIfPermitted
E/AccessibilityBridge(23441): VirtualView node must not be the root node.
E/AccessibilityBridge(23441): VirtualView node must not be the root node.
Syncing files to device SM G930F...
D/ViewRootImpl@6d35e33MainActivity: MSG_WINDOW_FOCUS_CHANGED 0
Syncing files to device SM G930F... 8.107ms (!)

�🔥 To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R
An Observatory debugger and profiler on SM G930F is available at: http://127.0.0.1:3197/4bUypygS5mY=/
For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".
D/ViewRootImpl@6d35e33MainActivity: MSG_WINDOW_FOCUS_CHANGED 1
V/InputMethodManager(23441): Starting input: tba=android.view.inputmethod.EditorInfo@4cfce49 nm : com.example.stt_test ic=null
I/InputMethodManager(23441): startInputInner - mService.startInputOrWindowGainedFocus
D/ViewRootImpl@6d35e33MainActivity: ViewPostIme pointer 0
D/ViewRootImpl@6d35e33MainActivity: ViewPostIme pointer 1
D/SpeechToTextPlugin(23441): setupRecognizerIntent
E/SpeechRecognizer(23441): bind to recognition service failed
I/flutter (23441): SpeechToText call: notifyStatus listening
E/AccessibilityBridge(23441): VirtualView node must not be the root node.
D/ViewRootImpl@6d35e33MainActivity: ViewPostIme pointer 0
D/ViewRootImpl@6d35e33MainActivity: ViewPostIme pointer 1
I/flutter (23441): SpeechToText call: notifyStatus notListening
E/AccessibilityBridge(23441): VirtualView node must not be the root node.
I/zygote64(23441): Do partial code cache collection, code=30KB, data=25KB
I/zygote64(23441): After code cache collection, code=30KB, data=25KB
I/zygote64(23441): Increasing code cache capacity to 128KB
D/ViewRootImpl@6d35e33MainActivity: ViewPostIme pointer 0
D/ViewRootImpl@6d35e33MainActivity: ViewPostIme pointer 1
D/SpeechToTextPlugin(23441): setupRecognizerIntent
E/SpeechRecognizer(23441): bind to recognition service failed
I/flutter (23441): SpeechToText call: notifyStatus listening
E/AccessibilityBridge(23441): VirtualView node must not be the root node.
D/ViewRootImpl@6d35e33MainActivity: ViewPostIme pointer 0
D/ViewRootImpl@6d35e33MainActivity: ViewPostIme pointer 1
I/flutter (23441): SpeechToText call: notifyStatus notListening
E/AccessibilityBridge(23441): VirtualView node must not be the root node.`

@cristianrablau
Copy link
Author

I can see E/SpeechRecognizer(23441): bind to recognition service failed in the logs.

@cristianrablau
Copy link
Author

cristianrablau commented Feb 23, 2020

@cristianrablau
Copy link
Author

cristianrablau commented Feb 25, 2020

@sowens-csd Do you think this is coming from the package? Or can it be fixed in the package?

flutter/flutter#34411 (comment)

@sowens-csd
Copy link
Contributor

Thanks for this report, this is really helpful. I'm going to do some research into that bind method and see what could cause failure. This at least helps localize the problem for me, thank you.

@sowens-csd sowens-csd added android bug Something isn't working labels Feb 25, 2020
sowens-csd pushed a commit that referenced this issue Mar 3, 2020
Some devices are failing to listen for speech. This
commit adds more checking to see if a recognizer
should be available on the device, if not it now returns
false on the initialize call. Also, more parts of the initialize
work are now done on the UI thread, per the Android
recommendations.
@sowens-csd
Copy link
Contributor

Some interesting content out there on this issue.

There are some SO threads that suggests a change to the Google Speech settings:
https://stackoverflow.com/questions/37607246/speechrecognizer-is-not-working-if-enhanced-google-services-is-selected
https://stackoverflow.com/questions/31986689/bind-to-recognition-service-failed, see the picture here https://i.stack.imgur.com/d1bDO.png

@sowens-csd
Copy link
Contributor

I just committed some changes that may help. There are two main approaches in this commit. The first is that the code now checks if a speech recognizer is available on the device before completing initialize. If it is not then initialization will fail with an exception. The second is that more sections of the initialization are done on the main UI thread. Some of the documentation suggests that various parts of the speech recognizer should be created on the main thread.

If you could try this version from the repo and let me know what happens that would be very helpful. I'd like the log output if it doesn't work.

@sowens-csd
Copy link
Contributor

1.0.0 is now on pub.dev with this fix. Let me know if it helps.

@cristianrablau
Copy link
Author

I will try the new version soon.

@cristianrablau
Copy link
Author

Hi @sowens-csd, thank you for all the support! Now I can see on the screen 'Speech recognition unavailable'. I will continue the investigation to see if I can find and change the SpeechRecognizer provider on my phone.

PS E:\git\Flutter\stt_test> flutter run
Launching lib\main.dart on SM G930F in debug mode...
Picked up _JAVA_OPTIONS: -Xverify:none
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 10,1s
√ Built build\app\outputs\apk\debug\app-debug.apk.
D/FlutterActivity(12878): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate(12878): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate(12878): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
W/FlutterEngine(12878): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@f08bcc0) but could not find and invoke the GeneratedPluginRegistrant.
D/FlutterActivityAndFragmentDelegate(12878): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView(12878): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@f08bcc0
D/FlutterActivityAndFragmentDelegate(12878): Executing Dart entrypoint: main, and sending initial route: /
D/SpeechToTextPlugin(12878): Start initialize
D/SpeechToTextPlugin(12878): Checked permission
D/SpeechToTextPlugin(12878): has permission, completing
D/SpeechToTextPlugin(12878): completeInitialize
D/SpeechToTextPlugin(12878): Testing recognition availability
E/SpeechToTextPlugin(12878): Speech recognition not available on this device
D/SpeechToTextPlugin(12878): leaving initializeIfPermitted
E/AccessibilityBridge(12878): VirtualView node must not be the root node.
E/flutter (12878): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(recognizerNotAvailable, Speech recognition not available on this device, )
E/flutter (12878): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (12878): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter (12878):
E/flutter (12878): #2 SpeechToText.initialize (package:speech_to_text/speech_to_text.dart:164:33)
E/flutter (12878): #3 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:45:6)
E/flutter (12878): #4 SpeechToText.initialize (package:speech_to_text/speech_to_text.dart:156:26)
E/flutter (12878): #5 _MyAppState.initSpeechState (package:stt_test/main.dart:29:35)
E/flutter (12878): #6 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:45:6)
E/flutter (12878): #7 _MyAppState.initSpeechState (package:stt_test/main.dart:28:31)
E/flutter (12878): #8 _MyAppState.initState (package:stt_test/main.dart:25:5)
E/flutter (12878): #9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)
E/flutter (12878): #10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter (12878): #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter (12878): #12 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter (12878): #13 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1028:16)
E/flutter (12878): #14 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:999:5)
E/flutter (12878): #15 RenderObjectToWidgetAdapter.attachToRenderTree. (package:flutter/src/widgets/binding.dart:942:17)
E/flutter (12878): #16 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2412:19)
E/flutter (12878): #17 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:941:13)
E/flutter (12878): #18 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:819:7)
E/flutter (12878): #19 WidgetsBinding.scheduleAttachRootWidget. (package:flutter/src/widgets/binding.dart:804:7)
E/flutter (12878): #20 _rootRun (dart:async/zone.dart:1122:38)
E/flutter (12878): #21 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (12878): #22 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
E/flutter (12878): #23 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:965:23)
E/flutter (12878): #24 _rootRun (dart:async/zone.dart:1126:13)
E/flutter (12878): #25 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (12878): #26 _CustomZone.bindCallback. (dart:async/zone.dart:949:23)
E/flutter (12878): #27 Timer._createTimer. (dart:async-patch/timer_patch.dart:23:15)
E/flutter (12878): #28 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)
E/flutter (12878): #29 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
E/flutter (12878): #30 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
E/flutter (12878):
Syncing files to device SM G930F...
8.122ms (!)

@cristianrablau
Copy link
Author

I managed to activate a speech recognition provider. Here are the steps:

  1. Go to Google Play
  2. Search for 'Google'
  3. You should find this app: https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox
  4. Mine was 'Disabled' so I enabled it

This is the SO post that helped: https://stackoverflow.com/questions/28769320/how-to-check-wether-speech-recognition-is-available-or-not

@cristianrablau
Copy link
Author

I don't know why but now I have an error after I press the 'Start' button: error_audio_error - true

D/ViewRootImpl@7fce584MainActivity: ViewPostIme pointer 0
D/ViewRootImpl@7fce584MainActivity: ViewPostIme pointer 1
D/SpeechToTextPlugin(23665): setupRecognizerIntent
I/flutter (23665): SpeechToText call: notifyStatus listening
I/flutter (23665): listening
E/AccessibilityBridge(23665): VirtualView node must not be the root node.
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: soundLevelChange -2.119999885559082
I/flutter (23665): SpeechToText call: notifyError {"errorMsg":"error_audio_error","permanent":true}
E/AccessibilityBridge(23665): VirtualView node must not be the root node.
D/ViewRootImpl@7fce584MainActivity: ViewPostIme pointer 0
D/ViewRootImpl@7fce584MainActivity: ViewPostIme pointer 1
I/flutter (23665): SpeechToText call: notifyStatus notListening
I/flutter (23665): notListening
I/flutter (23665): SpeechToText call: notifyError {"errorMsg":"error_client","permanent":true}
E/AccessibilityBridge(23665): VirtualView node must not be the root node.
I/zygote64(23665): Do partial code cache collection, code=28KB, data=25KB
I/zygote64(23665): After code cache collection, code=28KB, data=25KB
I/zygote64(23665): Increasing code cache capacity to 128KB

@cristianrablau
Copy link
Author

@sowens-csd Do you have any idea about the new error? Could it be something with my phone?

@sowens-csd
Copy link
Contributor

Sorry, I missed this follow up question. Given what you had to do to enable the recognizer I'm wondering if this could be related? https://stackoverflow.com/questions/46376193/android-speechrecognizer-audio-recording-error

Can you check the suggested fix on that thread and let me know if it helps?

@cristianrablau
Copy link
Author

The suggested fix worked. Thanks a lot for all the help! Now that we finally resolved all the problems I think these steps could be added in the documentation somewhere 😄 (it might help others as well)

@sowens-csd sowens-csd added documentation Improvements or additions to documentation and removed waiting for response labels Mar 21, 2020
@sowens-csd
Copy link
Contributor

That's great news. Sorry it took so long to get there, but very happy we've resolved it. I agree that this information could be really useful. I'll add an overview to the Readme and include a link to this thread as well. Thank you for your patience and help in diagnosing the issue. It's this kind of detail work that makes plugins better. I'll leave this open until I've updated the docs.

@cristianrablau
Copy link
Author

No problem @sowens-csd , keep it open as long as needed. Glad I could help!

sowens-csd pushed a commit that referenced this issue Mar 22, 2020
@sowens-csd
Copy link
Contributor

Documentation issue resolved in the latest Readme.

@Tanelo
Copy link

Tanelo commented Feb 21, 2021

I've found some error running the example and after settings all mic permissions right (like provided in the installing rules). Not working on android emulator : Launching lib/main.dart on sdk gphone x86 arm in debug mode... lib/main.dart:1 ✓ Built build/app/outputs/flutter-apk/app-debug.apk. I/OpenGLRenderer( 6584): Davey! duration=1169ms; Flags=1, IntendedVsync=1266212003476, Vsync=1266212003476, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1266224251500, AnimationStart=1266224294500, PerformTraversalsStart=1266224351500, DrawStart=1267268957500, SyncQueued=1267271314500, SyncStart=1267273870500, IssueDrawCommandsStart=1267274870500, SwapBuffers=1267319346500, FrameCompleted=1267383676500, DequeueBufferDuration=26147000, QueueBufferDuration=1357000, GpuCompleted=72904454231491230, I/Choreographer( 6584): Skipped 70 frames! The application may be doing too much work on its main thread. Connecting to VM Service at ws://127.0.0.1:54056/3MYwtnWls48=/ws I/flutter ( 6584): onStatus: listening I/flutter ( 6584): onError: SpeechRecognitionError msg: error_speech_timeout, permanent: true I/flutter ( 6584): onStatus: notListening

@Zhairgling
Copy link

I managed to activate a speech recognition provider. Here are the steps:

  1. Go to Google Play
  2. Search for 'Google'
  3. You should find this app: https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox
  4. Mine was 'Disabled' so I enabled it

This is the SO post that helped: https://stackoverflow.com/questions/28769320/how-to-check-wether-speech-recognition-is-available-or-not

Hi how did you install the app? I'm with a galaxy watch 4 classic and can't install the google App

@kusmayadi2022
Copy link

i have problem E/SpeechToTextPlugin( 3646): Speech recognition not available on this device E/flutter ( 3646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(recognizerNotAvailable, Speech recognition not available on this device, , null).. I've built a voice-driven android app that uses the android speech recognition API. I'm currently trying to convert the app to a wear-os version. I've included the speech recognition permission in the apps manifest and have initialized the speech recognition instance the same as I have in the mobile app (which works!). The app launches well, however when I begin the speech recognition I get the following error: E/SpeechRecognizer: no selected voice recognition service

I've tested on both a physical Galaxy 4 watch, and an API 30 wear-os emulator and the problem occurs with both devices. I've installed google assistant on the devices, and google assistants voice recognition works well. I can't find and voice input / speech recognition settings on the app. I'm not sure what next steps to take in debugging this.

I want voice recognition to be detected so that it can be used on Wearos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants