Skip to content

Commit

Permalink
Update re-thrown error for incompatible Java/Gradle versions to inclu…
Browse files Browse the repository at this point in the history
…de migration guide (#124327)

Update re-thrown error for incompatible Java/Gradle versions to include migration guide
  • Loading branch information
camsim99 committed Apr 12, 2023
1 parent 8abeefe commit f582b56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions packages/flutter_tools/lib/src/android/gradle_errors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -687,22 +687,12 @@ final GradleHandledError incompatibleJavaAndGradleVersionsHandler = GradleHandle
required bool usesAndroidX,
required bool multidexEnabled,
}) async {
final File gradlePropertiesFile = project.directory
.childDirectory('android')
.childDirectory('gradle')
.childDirectory('wrapper')
.childFile('gradle-wrapper.properties');
// TODO(reidbaker): Replace URL with constant defined in
// https://github.com/flutter/flutter/pull/123916.
globals.printBox(
"${globals.logger.terminal.warningMark} Your project's Gradle version "
'is incompatible with the Java version that Flutter is using for Gradle.\n\n'
'To fix this issue, first, check the Java version used by Flutter by '
'running `flutter doctor --verbose`.\n\n'
'Then, update the Gradle version specified in ${gradlePropertiesFile.path} '
'to be compatible with that Java version. '
'See the link below for more information on compatible Java/Gradle versions:\n'
'https://docs.gradle.org/current/userguide/compatibility.html#java\n\n',
'To fix this issue, consult the migration guide at docs.flutter.dev/go/android-java-gradle-error.',
title: _boxTitle,
);
return GradleBuildStatus.exit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ Could not compile build file '…/example/android/build.gradle'.

// Ensure the error notes the incompatible Gradle/AGP/Java versions and links to related resources.
expect(testLogger.statusText, contains('Gradle version is incompatible with the Java version'));
expect(testLogger.statusText, contains('https://docs.gradle.org/current/userguide/compatibility.html#java'));
expect(testLogger.statusText, contains('docs.flutter.dev/go/android-java-gradle-error'));
}, overrides: <Type, Generator>{
GradleUtils: () => FakeGradleUtils(),
Platform: () => fakePlatform('android'),
Expand Down

0 comments on commit f582b56

Please sign in to comment.