Before I install the speech_to_text package. Everything works fine. Once I install the package I cannot start the application on Android any longer and I get the following error message:
e: <PathToFlutter>\flutter\.pub-cache\hosted\pub.dartlang.org\speech_to_text-5.4.3\android\src\main\kotlin\com\csdcorp\speech_to_text\SpeechToTextPlugin.kt: (81, 8): Class 'SpeechToTextPlugin' is not abstract and does not implement abstract member public abstract
fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): Boolean defined in io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
e: <PathToFlutter>\flutter\.pub-cache\hosted\pub.dartlang.org\speech_to_text-5.4.3\android\src\main\kotlin\com\csdcorp\speech_to_text\SpeechToTextPlugin.kt: (627, 5): 'onRequestPermissionsResult' overrides nothing
e: <PathToFlutter>\flutter\.pub-cache\hosted\pub.dartlang.org\speech_to_text-5.4.3\android\src\main\kotlin\com\csdcorp\speech_to_text\SpeechToTextPlugin.kt: (771, 9): Class 'ChannelResultWrapper' is not abstract and does not implement abstract member public abstract fun error(p0: String, p1: String?, p2: Any?): Unit defined in io.flutter.plugin.common.MethodChannel.Result
e: <PathToFlutter>\flutter\.pub-cache\hosted\pub.dartlang.org\speech_to_text-5.4.3\android\src\main\kotlin\com\csdcorp\speech_to_text\SpeechToTextPlugin.kt: (786, 5): 'error' overrides nothing
e: <PathToFlutter>\flutter\.pub-cache\hosted\pub.dartlang.org\speech_to_text-5.4.3\android\src\main\kotlin\com\csdcorp\speech_to_text\SpeechToTextPlugin.kt: (789, 30): Type mismatch: inferred type is String? but String was expected
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':speech_to_text:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 4s
Running Gradle task 'assembleDebug'... 65.5s
Exception: Gradle task assembleDebug failed with exit code 1
The application is able to run in Web (Google Chrome).
Some of the things I have tried:
- I have tried to download this package in a brand new Flutter project. The same error occurred.
- I have tried to manually install the package
- https://stackoverflow.com/a/71561688/18725072 ; I could not use the package after I moved it.
- I have tried different versions of the package: speech_to_text 5.4.3, speech_to_text 5.4.2 and speech_to_text 2.3.0
My goal is to add a speech to text feature on text fields and make use of voice commands. If you need any other information to solve the problem please do let me know!
Edit: I am using Flutter version 1.0.0;
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId <ApplicatioId>
minSdkVersion 26
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
}