flutter_tts
flutter_tts copied to clipboard
Version 4.0.2 doesn't build
🐛 Bug Report
Whenever I tried version 4.0.2 in my sandboxes, it didn't build. It keeps giving me an error about Kotlin version needing to be 1.7.1, whereas Flutter told me to go to the last one. Reverted back to 3.8.5 and it worked. Also on Windows it doesn't build, says NUGET.exe is not available.
Expected behavior
flutter_tts version 4.0.2 should build both Windows and Android
Reproduction steps
Create a new Flutter project, then install flutter_tts with flutter pub add flutter_tts and try to build
Configuration
Flutter SDK: 3.19.6
Version: 4.0.2
Platform:
- [ ] :iphone: iOS
- [x] :robot: Android
Same issue on my side.
flutter_tts: ^3.8.1 this version is working
🐛 Bug Report
Whenever I tried version 4.0.2 in my sandboxes, it didn't build. It keeps giving me an error about Kotlin version needing to be 1.7.1, whereas Flutter told me to go to the last one. Reverted back to 3.8.5 and it worked. Also on Windows it doesn't build, says NUGET.exe is not available.
Expected behavior
flutter_tts version 4.0.2 should build both Windows and Android
Reproduction steps
Create a new Flutter project, then install flutter_tts with flutter pub add flutter_tts and try to build
Configuration
Flutter SDK: 3.19.6
Version: 4.0.2
Platform:
- [ ] 📱 iOS
- [x] 🤖 Android
Me too
To solve this issue the kotlin version of the flutter project itself has to be updated, as flutter_tts uses 1.9.10 (see android/build.gradle
in the tts plugin).
┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
│ update the │
│ version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of │
│ C:\folder\my_awesome_flutter_project\android\settings.gradle. │
│ │
│ Alternatively (if your project was created before Flutter 3.19), update │
│ C:\folder\my_awesome_flutter_project\android\build.gradle │
│ ext.kotlin_version = '<latest-version>' │
└──────────────────────────────────────────────────────────────────────────────────────────────┘
The error message shows, what to do, but to make it clear just go to android/settings.gradle
(if you are using a project built with version 3.19 or newer) or android/build.gradle
and set the version to 1.9.10
or newer.
To upgrade a project, which was written before 3.19, take a look at the documentation
A simple test application to test it is here:
import 'package:flutter/material.dart';
import 'package:flutter_tts/flutter_tts.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
void _speak() {
FlutterTts flutterTts = FlutterTts();
flutterTts.setLanguage('en-US');
flutterTts.speak('This should work');
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: Scaffold(
body: Center(
child: ElevatedButton(
onPressed: _speak,
child: const Text('test tts'),
),
)),
);
}
}
Thanks @rockerer ,
I've also addressed this here: https://github.com/dlutton/flutter_tts/issues/469 https://github.com/dlutton/flutter_tts/issues/479
It's basically to support this: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply
Also with regards to windows, "NUGET.exe is not available" means you either need to install it or it's not available in your path.
@dlutton Maybe it's worth mentioning to check the kotlin version in android section of the README.md? This might prevent more issues like this in the future.