csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
351 stars 218 forks source link

Speech_to_text not working on Android Physical device #175

Closed Tanelo closed 3 years ago

Tanelo commented 3 years ago

It seems that running speech_to_text is not possible on my device. `E/SpeechToTextPlugin(18694): Speech recognition not available on this device

E/flutter (18694): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(recognizerNotAvailable, Speech recognition not available on this device, , null) I've also tried to put the

</queries>` in the androidManifest, but it prevents the app from building. So it's not a problem of SDK version. 
sowens-csd commented 3 years ago

Have you tried following the steps in the troubleshooting section of the README doc for checking for speech availability on the device?

Tanelo commented 3 years ago

@sowens-csd Yes I did ! Thanks for answering

Tanelo commented 3 years ago

I think it has to do with the fact that it "is not available on my device" What is below is on my device E/SpeechToTextPlugin(23472): Speech recognition not available on this device E/flutter (23472): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(recognizerNotAvailable, Speech recognition not available on this device, , null) E/flutter (23472): #0 StandardMethodCodec.decodeEnvelope package:flutter/…/services/message_codecs.dart:582 E/flutter (23472): #1 MethodChannel._invokeMethod package:flutter/…/services/platform_channel.dart:159 E/flutter (23472):

However, when running on the android emulator, a different type of error occurs (however I've read all the readme). Launching lib/main.dart on sdk gphone x86 arm in debug mode... What is below is on the emulator lib/main.dart:1 ✓ Built build/app/outputs/flutter-apk/app-debug.apk. Connecting to VM Service at ws://127.0.0.1:55540/0qfsIlv19Lg=/ws I/flutter ( 6006): onStatus: listening I/flutter ( 6006): onError: SpeechRecognitionError msg: error_permission, permanent: true I/flutter ( 6006): onStatus: notListening

sowens-csd commented 3 years ago

Yes, that's a common problem on emulators, you frequently have to explicitly install speech recognition on emulators using the steps from that troubleshooting link. It is a little less common for physical devices though not unheard of.

If the steps in the troubleshooting guide didn't help what's the device type and OS version? You could try passing in the options array on the initialize method with androidIntentLookup as the only member. I'd be curious if that works. It works around devices that don't use the Android default speech recognizer intent.

Tanelo commented 3 years ago

My message was not clear enough, can you read it again ? Sorry :(

Tanelo commented 3 years ago

What concerns me is about the physical device..

sowens-csd commented 3 years ago

Sorry, I should have specified. The directions I provided were for you to try on the physical device. And I would like to know the device type and OS version for the physical device.

Tanelo commented 3 years ago

It is Huawei P40 Lite E, android 10, modèle : ART-L29. Yes I've followed the directions on troobleshooting. But i don't understand the new directions you shared.

Tanelo commented 3 years ago

I don't get that part : ' You could try passing in the options array on the initialize method with androidIntentLookup as the only member'

sowens-csd commented 3 years ago

Interesting, Huawei is one of the models that I think I have seen this issue with, that makes the options worth trying. Try this:

    var hasSpeech = await speech.initialize(
        onError: errorListener, onStatus: statusListener, debugLogging: true, options: [SpeechToText.androidIntentLookup]);
Tanelo commented 3 years ago

Not working after modifications : V/AudioManager(29390): querySoundEffectsEnabled... D/SpeechToTextPlugin(29390): Start initialize D/SpeechToTextPlugin(29390): Checked permission D/SpeechToTextPlugin(29390): has permission, completing D/SpeechToTextPlugin(29390): completeInitialize D/SpeechToTextPlugin(29390): Testing recognition availability E/SpeechToTextPlugin(29390): Speech recognition not available on this device D/SpeechToTextPlugin(29390): leaving initializeIfPermitted E/flutter (29390): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(recognizerNotAvailable, Speech recognition not available on this device, , null)

Tanelo commented 3 years ago

Not working on the simulator either.. With the same error...

Screenshot 2021-02-21 at 19 14 09
sowens-csd commented 3 years ago

Based on these results it looks to me like speech recognition is not installed on those devices. Is the Google speech assistant working on those devices? That's one way to verify that speech recognition at least might be functioning on them.

Tanelo commented 3 years ago

I dont think this thing is avaible. It is Huawei assistant. I'll try later on an other Android assistant. Screenshot_20210224_143358_com huawei hiassistantoversea

Still the plugin is not working on the emulator either.

sowens-csd commented 3 years ago

Any updates on this issue? Were you able to get it working on a device?

Tanelo commented 3 years ago

It's working fine on another device. Thanks !

BruceUnabia commented 2 months ago

it works on other devices that has a version of 12 and beyond but 11 and below it doesnt work.

BruceUnabia commented 2 months ago

how can i resolve this in order for it to work on any version of android devices