Unverified Commit f582b56e authored by Camille Simon's avatar Camille Simon Committed by GitHub

Update re-thrown error for incompatible Java/Gradle versions to include migration guide (#124327)

Update re-thrown error for incompatible Java/Gradle versions to include migration guide
parent 8abeefef
......@@ -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;
......
......@@ -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'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment