r/FlutterDev • u/lilacomets • Aug 06 '26
Discussion Anyone else experiencing the Flutter/Gradle upgrade hell?
Hello everyone!
It's this time of the year again where Google forces us to increase the target SDK level.
For me this is the only time I upgrade my Flutter environment. And when I do I go all the way, I upgrade the whole thing: Flutter itself and Android Studio and all of its plugins. On top of that I upgrade all pub packages in my projects to their latest versions. This time I also decided to start fresh and create a new Flutter project through the template in Android Studio for all my apps.
Every year, it's a struggle to get my apps to get my app working again. But this year it's particularly bad. Apparently the new Flutter project template uses Gradle 9 instead of 8. And that opens up a can of problems: plugins suddenly aren't compatible anymore and all my projects suddenly show a warning:
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by net.rubygrapefruit.platform.internal.NativeLibraryLoader in an unnamed module (file:/C:/Users/xxx/.gradle/wrapper/dists/gradle-9.5.0-all/aca6g93cdtcf0oapcfka748qh/gradle-9.5.0/lib/native-platform-0.22-milestone-29.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabledThere's very little written about this error, but it seems like Gradle 9 isn't compatible with the latest JDK version Android Studio ships with. Problem is that an empty Flutter project shows this warning out of the box. I tried downgrading my JDK version, but the warning stays. Great.
This is not it. There are more upcoming breaking changes due to switching to Kotlin. Now the following warning shows as well:
WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): device_info_plus, file_picker, keep_screen_on
Future versions of Flutter will fail to build if your app uses plugins that apply KGP.
Please check the changelogs of these plugins and upgrade to a version that supports Built-in Kotlin.
If no such version exists, report the issue to the plugin. If necessary, here is a guide on filing
an issue against a plugin: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-app-developers#report-incompatible-kotlin-gradle-plugin-usage-to-plugin-authorsSo basically the Flutter team is going to force another breaking change soon that causes plugins to stop working. It's just dumped on us: we're implementing another breaking change, deal with it. Just like that.
It's unbelievable that in 2026, in a time where AI exists, upgrading Flutter to the latest versions still isn't a smooth process. I've been working 3 days now to get my simple apps working again and I've been greeted with errors all the time.
I believe the source of most of the problems is Gradle. I wish that piece of crap was phased out. It's beyond me why they release Gradle version 9 that is not compatible with the latest JDK version. 🙃
Gradle is a non-functional, frustrating piece of misery that should be replaced ASAP by something modern that provides a smooth development experience.
Now I'm left with 3 apps in a broken state. Plugins that worked well are broken. I wish I never did the Flutter upgrade.
Anyone else has the same frustrating experience?
19
u/DigitallyDeadEd Aug 06 '26
It's a bit frustrating to find the configuration file magic incantations to make Flutter and gradle behave, but I haven't had a problem with this beyond futzing with things for a few minutes. I think you have an answer in your own post, though, use AI. Feed it the error and ask it what config changes need to happen to get your apps into a buildable, working state.
2
u/Suuii188 Aug 10 '26
I did flutter upgrade I regretted 🤣🤣, my MacBook Air 2015 could not update, my depencices crashed I had to reinstall them afresh which could work on my Mac
8
u/igorce007 Aug 06 '26 edited Aug 06 '26
Generally it’s not Flutter on its own. It’s problematic when we have Gradle or any iOS specific changes. Then it becomes hell. And also yeah I am very picky with packages that i use. That is another hell in this story. Generally reducing 3rd party packages needed significantly helps!
7
u/timus-the-orginal Aug 06 '26
I have similar feeling sadly :(
7
u/dmter Aug 06 '26
Here is my fool proof method - no llm needed at all.
First updare flutter and android sdk and studio to latest versions.
Then create new flutter project with your correct package name. then add dependencies needed for your project one by one making sure stub example app still compiles and runs and once they are all added, transfer dart code and test your app.
6
u/Acrobatic_Egg30 Aug 06 '26
I only fix errors and ignore warnings. Why are you tormenting yourself with warnings? I also only upgrade flutter weeks after the "stable" version is released to avoid any issues.
4
u/Useful-Move5612 Aug 06 '26
Yeah I had a project that I did not work on for a year and a half and wasn’t able to upgrade after days of struggling. Luckily one year later cursor managed to fix it with a few tries. Think this was back when sonnet 3 or so was released. Would hope today the newer models could help solving better. It’s a pain
4
u/BenoitDuffez Aug 06 '26
i was happy to send this problem back to google with the android studio AI agent. it burned happily a lot of tokens
my solution was to upgrade gradle to 9.6.1 (from v8), AGP to 9.3.0 (from v8)
this build system is horrendous. i've always hated it. sometimes i think of the eclipse days, and they were better
4
u/Legion_A Aug 07 '26
If you wait that long to upgrade then push everything to its latest version, it makes sense why it's a hellish experience. I upgrade quite often, but not immediately there's a new version, this way, the changes I have to make for breaking changes are minimal.
When you accumulate so many changes, it makes sense why it takes a lot to migrate.
3
u/raiyan_kun Aug 06 '26
I did not know gradle and android gradle are different, and had lots of other confusions and I wanted to k*** someone
3
u/TheOneTruePsychic Aug 06 '26
I think that's an exceptional use case. There should be an MCP, skill, or document that basically equips any frontier model to handle a version upgrade flawlessly (the only exception would be when your packages have not been updated to support the current version).
3
u/UnhappyCable859 Aug 06 '26
I recently upgraded my app to the new .kts and updated gradle using antigravity and it worked fine
2
u/jrosetali Aug 06 '26
Strongly agree. It's a time-consuming struggle that I dread each time. Nuts that this aspect of Flutter development is not more automatic and straightforward. And it's even worse on Mac than Windows.
2
u/leahcimp Aug 06 '26
Claude Code was a tremendous help getting me through this.
2
u/anzbert Aug 07 '26
What i do is use the latest version to create a blank project and then just copy the build.gradle.kts and settings.gradle.kts file settings.
2
u/abdallahshaban Aug 14 '26
We do provide the Android version combination that works best in our testing in stable releases - check them out under the "Android dependency matrix" section in this 3.47 release blog https://flutter.dev/blog/whats-new-in-flutter-3-47
3
u/Defiant-Swordfish423 Aug 07 '26
It exactly what I was thinking drinking the coffee this morning. Since I started using Flutter I've deployed 5 production apps and I started using Flutter since version 1.0.0.
Last month I created 2 new apps from scratch for two new projects and it is crazy to have compile warning as default. And when you start adding simple packages it is a complete mess. Android SDK and Gradle versions mismatches, official or big packages not aligned with Flutter release after months..
After 8 years, I'm thinking migrating to react native.
2
u/fkim98 Aug 06 '26 edited Aug 06 '26
Yes, and the thing that unstuck it for me was pinning the JDK instead of letting Android Studio decide. Those java.lang.System restricted-method warnings come from newer JDKs tightening native access, and Gradle's native library trips them. They're warnings, not failures, but they're noise you don't need — running on JDK 21 (LTS) made them go away for me. flutter config --jdk-dir=<path> so it's explicit rather than whatever the IDE ships this month.
The other thing I'd push back on gently: regenerating the project from the new template pulls the entire new toolchain in at once, which is why everything broke together. When I upgrade I move one axis at a time — Flutter SDK first, get a green build, then the Gradle wrapper and AGP, green build, then packages. Slower, but when something breaks you know what broke it.
The KGP warning is forward-looking rather than urgent — it's telling you plugins will need updating before a future release, not that this build is broken. I noted it and moved on.
1
u/yakupkahraman Aug 09 '26
I wonder if there's a project that makes Amper (JetBrains) compatible with Flutter? I don't know much about Amper, but after looking into it a bit, I really liked that it only has a single configuration file, etc. :D
1
u/AhmedRiyadh0 Aug 15 '26
Gradle is not really the issue here, it's mostly legacy Android decisions that are hard to get rid of. And Flutter is not at fault.
1
u/NoFlight8939 Sep 05 '26
once for me I upgraded everything to new versions but I wanted to cry at the end I used AI to stabilize them