Open jporrinoclapps opened 3 years ago
@jporrinoclapps I'm already looking into the issue as it's related to the same error mentioned in #260
@dlutton I read the FlutterTtsPlugin.java to further understand how the package works and how I could solve at least my problem. Also, to get rid of other variables in the equation, I continued my testing using your example code and running it in release mode.
Turns out I didn't need to use the setEngine method, as I am not going to change the tts engine from its default value, and an instance of TextToSpeech is already created during the package initialization (in the call to initInstance made after attachment to the FlutterEngine). I found that, as long as I don't use the setEngine method, the release mode build works just fine.
Also, the crash did not occur if I call the method speak before calling the method setEngine.
I hope this information helps you to figure out this strange behavior.
@jporrinoclapps that is very helpful thank you.
If the exact same thing happens to me before the realease is released, it breaks when performing a setEngine
@dqtorres are you possibly setting it to an engine that isn't installed on the device? By default it uses the Google TTS engine, so the setEngine method isn't necessary unless you plan on setting it to a different engine. You can call the method getEngines to see the options available to you.
@dlutton Thanks, if the setEngine method works correctly but only in debug, when the application is passed to release mode it gives the exception reported, all the devices work fine but only in debug. My goal is to use another tts engine and I get it to work on the device but when the realease is created on the same device by making the setEngines break, the getEngines method has previously been called to see the engines available on the device, it is a very error rare that it is not appreciated unless the release is created, thanks
@dqtorres do you receive the same error as mentioned by @jporrinoclapps?
@dqtorres After setting engine, it takes some time to fully initialize tts. Can you test example app with Future.delayed(Duration(seconds: 1));
right after setEngine?
@Syutkin @dlutton You are right, the release mode is too fast, I did what you said and fantastic it already works, but after initialization, Thank you very much again
initTts() async { flutterTts = FlutterTts(); await Future.delayed(Duration (seconds: 1));
π Bug Report
When I build my app in debug mode everything works OK. But, in release mode, although the tts engine is set to default (com.google.android.tts) correctly, the getLanguages method returns an empty array and the isLanguageAvailable always returns false. Also, the app crashes without any further call to any other methods (this last thing I think is related to the set of tts engine and not the languages).
Logs:
Doctor:
Expected behavior
App behavior should not change depending on build mode
Configuration
Added the following code as instructed but noticed no change. Also, the gradle's minSdkVersion is set to 21.
Version: ^3.2.1
Platform: