dlutton/flutter_tts

Version 4.0.2 doesn't build

Closed this issue ยท 7 comments

๐Ÿ› 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
  • ๐Ÿค– 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
  • ๐Ÿค– Android

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:
#469
#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.