flutter_tts icon indicating copy to clipboard operation
flutter_tts copied to clipboard

Version 4.0.2 doesn't build

Open GRawhideMart opened this issue 10 months ago • 2 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:

  • [ ] :iphone: iOS
  • [x] :robot: Android

GRawhideMart avatar Apr 22 '24 10:04 GRawhideMart

Same issue on my side.

guiguito avatar Apr 28 '24 14:04 guiguito

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

Azizbekshams avatar Apr 30 '24 10:04 Azizbekshams

Me too

paulinofonsecas avatar May 23 '24 00:05 paulinofonsecas

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'),
        ),
      )),
    );
  }
}

rockerer avatar Jun 10 '24 21:06 rockerer

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

dlutton avatar Jun 10 '24 21:06 dlutton

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 avatar Jun 10 '24 21:06 dlutton

@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.

rockerer avatar Jun 10 '24 22:06 rockerer