Skip to content

Commit 855aab9

Browse files
authored
[CP] Point kotlin message in gradle_errors.dart towards new place (#149881)
Cherry pick request of flutter/flutter#145936 to stable Update Flutter Fix log on how to update Kotlin Gradle Plugin that was introduced in Flutter 3.19.x Closes #149856
1 parent 761747b commit 855aab9

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

packages/flutter_tools/lib/src/android/gradle_errors.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,17 @@ final GradleHandledError incompatibleKotlinVersionHandler = GradleHandledError(
441441
final File gradleFile = project.directory
442442
.childDirectory('android')
443443
.childFile('build.gradle');
444+
final File settingsFile = project.directory
445+
.childDirectory('android')
446+
.childFile('settings.gradle');
444447
globals.printBox(
445448
'${globals.logger.terminal.warningMark} Your project requires a newer version of the Kotlin Gradle plugin.\n'
446-
'Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update ${gradleFile.path}:\n'
447-
"ext.kotlin_version = '<latest-version>'",
449+
'Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update the \n'
450+
'version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of \n'
451+
'${settingsFile.path}.\n\n'
452+
'Alternatively (if your project was created before Flutter 3.19), update \n'
453+
'${gradleFile.path}\n'
454+
"ext.kotlin_version = '<latest-version>'",
448455
title: _boxTitle,
449456
);
450457
return GradleBuildStatus.exit;

packages/flutter_tools/test/general.shard/android/gradle_errors_test.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -814,13 +814,18 @@ Execution failed for task ':app:generateDebugFeatureTransitiveDeps'.
814814
expect(
815815
testLogger.statusText,
816816
contains(
817-
'\n'
818-
'┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────┐\n'
819-
'│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │\n'
820-
'│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │\n'
821-
'│ update /android/build.gradle: │\n'
822-
"│ ext.kotlin_version = '<latest-version>' │\n"
823-
'└────────────────────────────────────────────────────────────────────────────────────────────┘\n'
817+
'\n'
818+
'┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────┐\n'
819+
'│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │\n'
820+
'│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │\n'
821+
'│ update the │\n'
822+
'│ version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of │\n'
823+
'│ /android/settings.gradle. │\n'
824+
'│ │\n'
825+
'│ Alternatively (if your project was created before Flutter 3.19), update │\n'
826+
'│ /android/build.gradle │\n'
827+
"│ ext.kotlin_version = '<latest-version>' │\n"
828+
'└──────────────────────────────────────────────────────────────────────────────────────────────┘\n'
824829
)
825830
);
826831
}, overrides: <Type, Generator>{

0 commit comments

Comments
 (0)