New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Gradle version is incompatible with the Java version" but flutter doctor is all green #130515
Comments
cc @reidbaker since this seems similar to recent issues you've looked at |
This isn't something that Have you followed the instructions in the "Flutter Fix" message in your output? |
It also might help to use the |
I think it's important that if |
We may not have project level info in flutter doctor, but we can know the template values. So we could print warnings if we detect that the
|
Capturing from Discord discussion, my vote would be that we don't go beyond yellow text that says something like:
Anything we put in |
Other ideas are that we could: Also if you have strong feelings on how this relates to #125653, I would appreciate them there 🙂 |
We'd probably want to get stats on JDK versions in use first; actually breaking people just to reduce false positives is a big step unless we believe that the number of affected people is small. (I would like to see use drop some older AGP/Gradle versions based on some of our recent experiences maintaining the full range, but that's about actually reducing our support burden and serious accidental breakages, rather than just
I thought about that, but it's not going to just to just be the versions; we'd then need to make all of the gradle files compatible with the full range, or make all the parts of those be conditional, and that could get very messy very quickly. I guess with enough automated tests to make sure every configuration builds it could be doable... |
What do we think about running additional code when you run flutter doctor from the root of a flutter project? It breaks the universality but gives us a way to run project specific code evaluation and is a reasonable place for people to try to run the command. I dont see how we can not check project specific values in futter doctor and have flutter doctor green mean you can build a project. |
I think that would be a good start. Obviously making ourselves compatible with a broader range of versions of our dependencies (in particular those we don't pin) would be ideal, but that seems like it would be a disproportionate maintenance and test burden. Another option would be to bring in our own dependency so we could pin it, but that may also be non-trivial compared to just detecting the conflict with our templates and reporting it as an FYI in the output. |
It doesn't have to mean you can build any project, just that you won't run into trouble if you create a new one and try to run it. (If it had to report any issue, we'd need to bring in |
I also filed #130808 because if this had happened on master the error message would have been confusing in this case (as opposed to how it is here in stable). |
After thinking more about this, I think doing this in combination with updating our templates to use the latest version of Gradle is the correct solution. My understanding is that our ability to support newer versions of Java is bounded by Gradle's support of newer versions of Java. So if we are always using the latest version of Gradle, we are always supporting as recent a version of Java as we can. It does mean that if a developer is using stable, and:
But I think it is reasonable for us to print a warning that says (with better phrasing) "you are using a newer version of Java than the newest version that Gradle supported at the time of last stable cut, and we can't confirm thats safe to use". It's basically just a flutter doctor check that your Java version isn't newer than we could know about. |
If we start using AGP 8 in the template, people making new projects won't be able to use any plugins that haven't updated to add a |
AGP 8 also requires Java 17. I'm not suggesting AGP 8 though (for that reason and the one you mentioned), only the latest Gradle. The latest Gradle does not require AGP 8 (https://docs.gradle.org/current/userguide/compatibility.html#android) |
👍🏻 Sorry, I misremembered the compat tables and thought the latest Gradle had dropped 7.x. No objection from me to upping the AGP minimum to 7.3 (and I certainly won't miss 4.x). |
To follow up on the solution that @gmackall proposed, one way we could try to mitigate 3 is instead of adding the warning to |
That is a genuinely clever thought @camsim99. I think that would align with Ian's statement |
…ate` (#131444) Adds warning to `flutter create` command that checks if detected Java version is compatible with the template AGP and template Gradle versions. If a developer is building for Android and their Java version is incompatible with either the AGP or Gradle versions that Flutter currently supports by default for new Flutter projects, then - a warning will show noting the incompatibility and - steps will be shown to fix the issue, the recommended option being to configure a new compatible Java version given that Flutter knows we can support the template Gradle/AGP versions and updating them manually may be risky (feedback on this approach would be greatly appreciated!) Given that the template AGP and Gradle versions are compatible, this PR assumes that the detected Java version may only conflict with one of the template AGP or Gradle versions because: - the minimum Java version for a given AGP version is less than the maximum Java version compatible for the minimum Gradle version required for that AGP version (too low a Java version will fail AGP compatibility test, but not Gradle compatibility). - the maximum Java version compatible with minimum Gradle version for a given AGP version is higher than minimum Java version required for that AGP version (too high a Java version will fail Gradle compatibility test, but not AGP compatibility test). Fixes #130515 in the sense that `flutter create foo`; `cd foo`; `flutter run` should always be successful.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
…ate` (flutter#131444) Adds warning to `flutter create` command that checks if detected Java version is compatible with the template AGP and template Gradle versions. If a developer is building for Android and their Java version is incompatible with either the AGP or Gradle versions that Flutter currently supports by default for new Flutter projects, then - a warning will show noting the incompatibility and - steps will be shown to fix the issue, the recommended option being to configure a new compatible Java version given that Flutter knows we can support the template Gradle/AGP versions and updating them manually may be risky (feedback on this approach would be greatly appreciated!) Given that the template AGP and Gradle versions are compatible, this PR assumes that the detected Java version may only conflict with one of the template AGP or Gradle versions because: - the minimum Java version for a given AGP version is less than the maximum Java version compatible for the minimum Gradle version required for that AGP version (too low a Java version will fail AGP compatibility test, but not Gradle compatibility). - the maximum Java version compatible with minimum Gradle version for a given AGP version is higher than minimum Java version required for that AGP version (too high a Java version will fail Gradle compatibility test, but not AGP compatibility test). Fixes flutter#130515 in the sense that `flutter create foo`; `cd foo`; `flutter run` should always be successful.
Is there an existing issue for this?
Steps to reproduce
Actual results
The actual result should be that the app displays on my phone
Logs
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: