Skip to content
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

[Android] Add Java/AGP/Gradle incompatibility warning to flutter create #131444

Merged
merged 70 commits into from Sep 20, 2023

Conversation

camsim99
Copy link
Contributor

@camsim99 camsim99 commented Jul 27, 2023

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.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jul 27, 2023
@camsim99 camsim99 marked this pull request as ready for review August 16, 2023 21:04
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 21, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 22, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Sep 23, 2023
…4985)

Manual roll Flutter from 893650416352 to f92884c7b846 (48 revisions)

Manual roll requested by dit@google.com

flutter/flutter@8936504...f92884c

2023-09-21 jiahaog@users.noreply.github.com Rename `debugProfilePlatformChannels` to a constant that works in release mode (flutter/flutter#134922)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com Mark ReastaurationManager not disposed (flutter/flutter#134832)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com cover more tests with leak tracing (flutter/flutter#134834)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com Fix leak in hardware_keyboard_test.dart (flutter/flutter#134380)
2023-09-20 sokolovskyi.konstantin@gmail.com Fix memory leak in _SelectableTextState (flutter/flutter#135049)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 39c0f2ea1f53 to 89d864552acd (4 revisions) (flutter/flutter#135169)
2023-09-20 ditman@gmail.com [deps] Update package:web dependency. (flutter/flutter#135174)
2023-09-20 yjbanov@google.com finer grained logging of Chromium launch sequence (flutter/flutter#135078)
2023-09-20 34871572+gmackall@users.noreply.github.com Upgrade AGP version in tracing_tests (flutter/flutter#134671)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com Cover cupertino/form_section_test with leak tracing (flutter/flutter#135158)
2023-09-20 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking #7 (flutter/flutter#134943)
2023-09-20 goderbauer@google.com Enable strict-inference (flutter/flutter#135043)
2023-09-20 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking #10 (flutter/flutter#135143)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com cover more tests with leak tracing (flutter/flutter#134833)
2023-09-20 ychris@google.com codeisn extension safe iOS framework (flutter/flutter#134966)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6f256257b79f to 55314d08d792 (2 revisions) (flutter/flutter#135151)
2023-09-20 gspencergoog@users.noreply.github.com Remove 'must be non-null' and 'must not be null' comments in widgets library (flutter/flutter#134992)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5f82fc2f6f24 to 6f256257b79f (1 revision) (flutter/flutter#135147)
2023-09-20 43054281+camsim99@users.noreply.github.com [Android] Add Java/AGP/Gradle incompatibility warning to `flutter create` (flutter/flutter#131444)
2023-09-20 engine-flutter-autoroll@skia.org Roll Packages from d4e2454 to 51e74b9 (12 revisions) (flutter/flutter#135145)
2023-09-20 gspencergoog@users.noreply.github.com Remove 'must not be null' comments from various libraries. (flutter/flutter#134984)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6535421b30d3 to 5f82fc2f6f24 (2 revisions) (flutter/flutter#135142)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 67d4aaef3c7b to 6535421b30d3 (1 revision) (flutter/flutter#135139)
2023-09-20 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking #8 (flutter/flutter#135045)
2023-09-20 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking #9 (flutter/flutter#135054)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 83b4df415bf3 to 67d4aaef3c7b (1 revision) (flutter/flutter#135128)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from df4e6c079682 to 83b4df415bf3 (2 revisions) (flutter/flutter#135102)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9c6b2500282b to df4e6c079682 (1 revision) (flutter/flutter#135101)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 24f7ac38dfa2 to 9c6b2500282b (3 revisions) (flutter/flutter#135098)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 36379b62bec8 to 24f7ac38dfa2 (2 revisions) (flutter/flutter#135096)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 81b93fc4a2cc to 36379b62bec8 (2 revisions) (flutter/flutter#135095)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5a924a9017d7 to 81b93fc4a2cc (2 revisions) (flutter/flutter#135093)
2023-09-20 gspencergoog@users.noreply.github.com Remove 'must be non-null' and 'must not be null' comments from material. (flutter/flutter#134991)
2023-09-20 34871572+gmackall@users.noreply.github.com Unpin url launcher (remake) (flutter/flutter#134958)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from a7af55c56aa6 to 5a924a9017d7 (10 revisions) (flutter/flutter#135085)
2023-09-20 engine-flutter-autoroll@skia.org Manual roll Flutter Engine from a7af55c56aa6 to 0d7db40c27fd (7 revisions) (flutter/flutter#135079)
2023-09-20 gspencergoog@users.noreply.github.com Remove 'must not be null' comments from painting and rendering libraries. (flutter/flutter#134993)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com cover more tests with leak tracking (flutter/flutter#134837)
2023-09-20 xilaizhang@google.com [flutter roll] Revert "Native assets support for Linux" (flutter/flutter#135069)
2023-09-20 engine-flutter-autoroll@skia.org Manual roll Flutter Engine from 10c480310926 to a7af55c56aa6 (4 revisions) (flutter/flutter#135071)
2023-09-19 zanderso@users.noreply.github.com Retry Linux web tests 1 time on roll presubmit (flutter/flutter#135073)
2023-09-19 ditman@gmail.com [web] Encode AssetManifest.bin as JSON and use that on the web. (flutter/flutter#131382)
2023-09-19 polinach@google.com Specify suggested format in doc comment. (flutter/flutter#134887)
2023-09-19 engine-flutter-autoroll@skia.org Manual roll Flutter Engine from 28f14e6eec4f to 10c480310926 (6 revisions) (flutter/flutter#135066)
...
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…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.
auto-submit bot pushed a commit that referenced this pull request Oct 10, 2023
Specifies that compatible Java range stated in warning when Java version is incompatible with our template AGP & Gradle versions notes an exclusive upper bound Java version. This was a bug from #131444, and I will file a CP request to stable once this lands.

The warning uses [`getJavaVersionFor`](https://github.com/flutter/flutter/blob/b5c8fd11e4906d900039584b4f67c9753327060c/packages/flutter_tools/lib/src/android/gradle_utils.dart#L606), which returns an exclusive upper bound, which is why this fix is necessary.
camsim99 added a commit to camsim99/flutter that referenced this pull request Oct 17, 2023
…er#135710)

Specifies that compatible Java range stated in warning when Java version is incompatible with our template AGP & Gradle versions notes an exclusive upper bound Java version. This was a bug from flutter#131444, and I will file a CP request to stable once this lands.

The warning uses [`getJavaVersionFor`](https://github.com/flutter/flutter/blob/b5c8fd11e4906d900039584b4f67c9753327060c/packages/flutter_tools/lib/src/android/gradle_utils.dart#L606), which returns an exclusive upper bound, which is why this fix is necessary.
camsim99 added a commit to camsim99/flutter that referenced this pull request Oct 17, 2023
…er#135710)

Specifies that compatible Java range stated in warning when Java version is incompatible with our template AGP & Gradle versions notes an exclusive upper bound Java version. This was a bug from flutter#131444, and I will file a CP request to stable once this lands.

The warning uses [`getJavaVersionFor`](https://github.com/flutter/flutter/blob/b5c8fd11e4906d900039584b4f67c9753327060c/packages/flutter_tools/lib/src/android/gradle_utils.dart#L606), which returns an exclusive upper bound, which is why this fix is necessary.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2023
HugoOlthof pushed a commit to moneybird/packages that referenced this pull request Dec 13, 2023
…lutter#4985)

Manual roll Flutter from 893650416352 to f92884c7b846 (48 revisions)

Manual roll requested by dit@google.com

flutter/flutter@8936504...f92884c

2023-09-21 jiahaog@users.noreply.github.com Rename `debugProfilePlatformChannels` to a constant that works in release mode (flutter/flutter#134922)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com Mark ReastaurationManager not disposed (flutter/flutter#134832)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com cover more tests with leak tracing (flutter/flutter#134834)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com Fix leak in hardware_keyboard_test.dart (flutter/flutter#134380)
2023-09-20 sokolovskyi.konstantin@gmail.com Fix memory leak in _SelectableTextState (flutter/flutter#135049)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 39c0f2ea1f53 to 89d864552acd (4 revisions) (flutter/flutter#135169)
2023-09-20 ditman@gmail.com [deps] Update package:web dependency. (flutter/flutter#135174)
2023-09-20 yjbanov@google.com finer grained logging of Chromium launch sequence (flutter/flutter#135078)
2023-09-20 34871572+gmackall@users.noreply.github.com Upgrade AGP version in tracing_tests (flutter/flutter#134671)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com Cover cupertino/form_section_test with leak tracing (flutter/flutter#135158)
2023-09-20 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking flutter#7 (flutter/flutter#134943)
2023-09-20 goderbauer@google.com Enable strict-inference (flutter/flutter#135043)
2023-09-20 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking flutter#10 (flutter/flutter#135143)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com cover more tests with leak tracing (flutter/flutter#134833)
2023-09-20 ychris@google.com codeisn extension safe iOS framework (flutter/flutter#134966)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6f256257b79f to 55314d08d792 (2 revisions) (flutter/flutter#135151)
2023-09-20 gspencergoog@users.noreply.github.com Remove 'must be non-null' and 'must not be null' comments in widgets library (flutter/flutter#134992)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5f82fc2f6f24 to 6f256257b79f (1 revision) (flutter/flutter#135147)
2023-09-20 43054281+camsim99@users.noreply.github.com [Android] Add Java/AGP/Gradle incompatibility warning to `flutter create` (flutter/flutter#131444)
2023-09-20 engine-flutter-autoroll@skia.org Roll Packages from d4e2454 to 51e74b9 (12 revisions) (flutter/flutter#135145)
2023-09-20 gspencergoog@users.noreply.github.com Remove 'must not be null' comments from various libraries. (flutter/flutter#134984)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6535421b30d3 to 5f82fc2f6f24 (2 revisions) (flutter/flutter#135142)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 67d4aaef3c7b to 6535421b30d3 (1 revision) (flutter/flutter#135139)
2023-09-20 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking flutter#8 (flutter/flutter#135045)
2023-09-20 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking flutter#9 (flutter/flutter#135054)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 83b4df415bf3 to 67d4aaef3c7b (1 revision) (flutter/flutter#135128)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from df4e6c079682 to 83b4df415bf3 (2 revisions) (flutter/flutter#135102)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9c6b2500282b to df4e6c079682 (1 revision) (flutter/flutter#135101)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 24f7ac38dfa2 to 9c6b2500282b (3 revisions) (flutter/flutter#135098)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 36379b62bec8 to 24f7ac38dfa2 (2 revisions) (flutter/flutter#135096)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 81b93fc4a2cc to 36379b62bec8 (2 revisions) (flutter/flutter#135095)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5a924a9017d7 to 81b93fc4a2cc (2 revisions) (flutter/flutter#135093)
2023-09-20 gspencergoog@users.noreply.github.com Remove 'must be non-null' and 'must not be null' comments from material. (flutter/flutter#134991)
2023-09-20 34871572+gmackall@users.noreply.github.com Unpin url launcher (remake) (flutter/flutter#134958)
2023-09-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from a7af55c56aa6 to 5a924a9017d7 (10 revisions) (flutter/flutter#135085)
2023-09-20 engine-flutter-autoroll@skia.org Manual roll Flutter Engine from a7af55c56aa6 to 0d7db40c27fd (7 revisions) (flutter/flutter#135079)
2023-09-20 gspencergoog@users.noreply.github.com Remove 'must not be null' comments from painting and rendering libraries. (flutter/flutter#134993)
2023-09-20 82763757+NobodyForNothing@users.noreply.github.com cover more tests with leak tracking (flutter/flutter#134837)
2023-09-20 xilaizhang@google.com [flutter roll] Revert "Native assets support for Linux" (flutter/flutter#135069)
2023-09-20 engine-flutter-autoroll@skia.org Manual roll Flutter Engine from 10c480310926 to a7af55c56aa6 (4 revisions) (flutter/flutter#135071)
2023-09-19 zanderso@users.noreply.github.com Retry Linux web tests 1 time on roll presubmit (flutter/flutter#135073)
2023-09-19 ditman@gmail.com [web] Encode AssetManifest.bin as JSON and use that on the web. (flutter/flutter#131382)
2023-09-19 polinach@google.com Specify suggested format in doc comment. (flutter/flutter#134887)
2023-09-19 engine-flutter-autoroll@skia.org Manual roll Flutter Engine from 28f14e6eec4f to 10c480310926 (6 revisions) (flutter/flutter#135066)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Gradle version is incompatible with the Java version" but flutter doctor is all green
4 participants