Is it reasonable to expect widely used packages to be up to date on their Gradle implementations? Here is a specific case.
I got a strange Gradle error on a new project build for Android. Gemini had a hilarious time trying to fix this by updating my already updated Gradle installation. Then I generated a default new Flutter Project, built it, added packages to pubspec.yaml and rebuilt the App after each package. This error recurred after adding flutter_gl.
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':flutter_gl' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61
The flutter_gl package (downloads 1.4K, last version 0.0.21 in 2023) apparently uses an older version of Gradle. I found an issue in the related github repository.
That issue was first opened 11/9/2023. The solution was “… adding an dependency override in my project’s pubspec.yaml, updating it to the commit that has the fix merged … and copy the .aar file to my project)”
That seems like a temporary solution on a 1.5 year old issue. I would be uncomfortable going to production with this patch. Is this a reasonable issue to report to pub.dev or am I overreacting? With the rise of Flutter 3D graphics (OpenGL?), is flutter_gl expected to disappear? Any thoughts?
If a package doesn’t work, I don’t think they can do much about it. Even on the report page, you can only report illegal content and policy violations. Probably people are still using it(hundreds of weekly downloads) so they’re not going to remove it, just because it doesn’t work with your configs. Packages are not required to be compatible with new flutter versions. Lot of projects use old versions.
Only thing you can do is to use an older flutter version(maybe android studio too) or fork it and fix it or find a package that is maintained. I generally try to not use anything that wasn’t updated in more than a year, unless if it’s something simple. Graphics is not simple.
I cannot easily jump to flutter_angle as I also use theee_dart which uses flutter_gl. I admit that I have not stayed up on on some of the issues surrounding the changes to Gradle. Are packages pinned by the version of Gradle they use? Is the newer Gradle not backward compatible for existing users?
I wonder whether my recent Android Studio upgrade is incomplete. In my KTS files I get “link Gradle project”. When I look for a project level .gradle file it is not there. is .gradle still used for kts DSL files?
I have this song running through my head from the dawn of the MTV era: “KTS killed the Flutter/Dart Star” (with apologies to the Buggles). Silly but I am spending too much time on this and Gemini is no help!
My original issue was that the flutter_gl package was not compatible with the version of Gradle on Android Studio Ladybug and Meerkat. I solved that by making a fork of flutter_gl and changing the Gradle settings. I got that solution from an issue in the flutter GL GitHub repository. Along the way Gemini helped me trash all my Gradle settings. I ended up deleting my user /… /.gradle settings and reloading Android Studio. I still need to copy an .aar file but I think I am on the right track.
If anyone cares, here are the steps I went through to get an out of date package to work with the DEFAULT FLUTTER COUNTER project that is generated when you start a new Flutter Project in Android Studio Meerkat.
// PROJECT: I created a default Counter project in Android Studio Meerkat. All targets, Kotlin language
// PROJECT: In pubspec.yaml I added one package dependency for flutter_gl Actually I
// added a dependency for three_dart and tested all of its dependencies one at a time until I found the flutter_gl issue
// GITHUB: Created a fork of flutter_gl per GitHub · Where software is built
// CACHE: Added a Namespace to my fork of flutter_gl in this file
// C:\Users\pault\AppData\Local\Pub\Cache\git\flutter_gl-a5b8ff7287a4deb4e1931eba86e5644adfbb7c19\flutter_gl\android\build.gradle
// PROJECT: Added reference to this fork in my pubspec.yaml per @mihalycsaba and GitHub · Where software is built
// PROJECT: Updated NDK version from flutter default to “27.0.12077973” in android\app\build.gradle.kts
// PROJECT: Updated Android SDK version from flutter default to 24 in android\app\build.gradle.kts
// PROJECT: Copied threeegl.aar file from flutter_gl to android\app\libs\aars per build failed could not find threeegl.aar UPD:SOLVED(NOOB ISSUE) · Issue #53 · wasabia/flutter_gl · GitHub
// Source is flutter_gl/flutter_gl/android/libs/aars/threeegl.aar at main · wasabia/flutter_gl · GitHub
// Eliminated package reference in
// CACHE C:\Users\pault\AppData\Local\Pub\Cache\git\flutter_gl-a5b8ff7287a4deb4e1931eba86e5644adfbb7c19\flutter_gl\android\src\main\AndroidManifest.xml
// PROJECT: Added tools:replace=“android:label” to android\app\src\main\AndroidManifest.xml
// PROJECT: Followed advice to ignore different kotlin.jvm.targets in StackOverflow as follows
// https://stackoverflow.com/questions/77520506/inconsistent-jvm-target-compatibility-detected-for-tasks-despite-already-definin
I hope this is instructive. I have passed this on to the package issue log for what it is worth.
Good that you found some workarounds. This means that the code itself is working, shouldn’t be impossible to figure out the gradle issues without workarounds.
Using contents of this forum for the purposes of training proprietary AI models is forbidden. Only if your AI model is free & open source, go ahead and scrape. Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.