dlutton / flutter_tts

Flutter Text to Speech package
MIT License
617 stars 258 forks source link

Android release build getting failed due to incompatible Kotlin version, when I ran 'flutter build apk --split-per-abi' command #515

Closed Sanavenkatesh closed 3 months ago

Sanavenkatesh commented 4 months ago

🐛 Bug Report

The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (682, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (683, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (685, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (691, 56): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (703, 40): Unresolved reference: javaClass e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (704, 26): Unresolved reference: indices e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (705, 23): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (707, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (710, 29): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (713, 23): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (715, 23): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class e: C:\Users\svenk\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-4.0.2\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt: (717, 23): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from C:/Users/svenk/.gradle/caches/transforms-3/b1f5b19fcf6d946b29ce7fc39bb6e3dc/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1792 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.

FAILURE: Build failed with an exception.

BUILD FAILED in 30s Running Gradle task 'assembleRelease'... 32.1s

┌─ 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:\Users\svenk\OneDrive\Desktop\flutter\letter_zoo\android\settings.gradle. │ │ │ │ Alternatively (if your project was created before Flutter 3.19), update │ │ C:\Users\svenk\OneDrive\Desktop\flutter\letter_zoo\android\build.gradle │ │ ext.kotlin_version = '' │ └────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Gradle task assembleRelease failed with exit code 1

Expected behavior

should generate Release build apk, when I run 'flutter build apk --split-per-abi' command

Reproduction steps

run 'flutter build apk --split-per-abi' command I tried with all Kotlin versions, but still not building

Configuration

**Version: 4.0.2

Platform:

dlutton commented 4 months ago

@Sanavenkatesh did you try updating per the README?

sivaprasadnk commented 4 months ago

@Sanavenkatesh please try updating the kotlin version to latest ( 2.0.0 )

Sanavenkatesh commented 4 months ago

@dlutton , @sivaprasadnk, I attempted both solutions, but unfortunately, neither resolved the issue. However, I discovered that downgrading flutter_tts to version 3.8.5 works. After making this change, everything is functioning properly.