dlutton / flutter_tts

Flutter Text to Speech package
MIT License
602 stars 250 forks source link

Android 11 TextToSpeech init failed #189

Closed winniexuwen closed 3 years ago

winniexuwen commented 3 years ago

🐛 Bug Report

Expected behavior

Android 11 can speak normally

Reproduction steps

  1. use Android 11 to run example, can not speak.

    Configuration

    Android 11 Version: 0.1.x

Platform:

dlutton commented 3 years ago

What's the error you're receiving? Do you have the google TTS engine installed on your device? Are you able to run await flutterTts.getEngines();?

jp555soul commented 3 years ago

I'm having issues on Android 11 also:

Device:

TTS engine installed:

getEngines():

Error:

D/SpeechToTextPlugin(20163): Start initialize
D/SpeechToTextPlugin(20163): Checked permission
D/SpeechToTextPlugin(20163): has permission, completing
D/SpeechToTextPlugin(20163): completeInitialize
D/SpeechToTextPlugin(20163): Testing recognition availability
E/SpeechToTextPlugin(20163): Speech recognition not available on this device
D/SpeechToTextPlugin(20163): leaving initializeIfPermitted
I/flutter (20163): TtsLanguages: [ko-KR, mr-IN, ru-RU, zh-TW, hu-HU, th-TH, ur-PK, nb-NO, da-DK, tr-TR, et-EE, bs, sw, pt-PT, vi-VN, en-US, sv-SE, ar, su-ID, bn-BD, gu-IN, kn-IN, el-GR, hi-IN, fi-FI, km-KH, bn-IN, fr-FR, uk-UA, en-AU, nl-NL, fr-CA, sr, pt-BR, ml-IN, si-LK, de-DE, ku, cs-CZ, pl-PL, sk-SK, fil-PH, it-IT, ne-NP, hr, en-NG, zh-CN, es-ES, cy, ta-IN, ja-JP, sq, yue-HK, en-IN, es-US, jv-ID, la, id-ID, te-IN, ro-RO, ca, en-GB]
I/flutter (20163): com.google.android.tts
E/flutter (20163): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(recognizerNotAvailable, Speech recognition not available on this device, , null)
E/flutter (20163): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7)
E/flutter (20163): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)
E/flutter (20163): <asynchronous suspension>
E/flutter (20163): #2      SpeechToText.initialize (package:speech_to_text/speech_to_text.dart:189:19)
E/flutter (20163): <asynchronous suspension>
E/flutter (20163): #3      SttManager.init (package:curingcrystals/utils/speech_language/stt_manager.dart:41:24)
E/flutter (20163): <asynchronous suspension>
E/flutter (20163): #4      Future.wait.<anonymous closure> (dart:async/future.dart)
E/flutter (20163): <asynchronous suspension>
E/flutter (20163): #5      SpeechLanguageManager.initialize (package:curingcrystals/utils/speech_language/speech_language_manager.dart:38:37)
E/flutter (20163): <asynchronous suspension>
E/flutter (20163): #6      _SettingsComponentState.build.<anonymous closure>.<anonymous closure> (package:curingcrystals/ui/screens/settings/component/settings_component.dart)
E/flutter (20163): <asynchronous suspension>
E/flutter (20163): 
dlutton commented 3 years ago

It appears you're attempting to use a SpeechToTextPlugin with this plugin. It appears the SpeechToTextPlugin is throwing the error Speech recognition not available on this device which is unrelated to this Text to Speech plugin.