Unverified Commit c8538873 authored by Tacca's avatar Tacca Committed by GitHub

95533 min sdk error msgs enhancements (#99550)

parent 9240c9a0
...@@ -97,7 +97,7 @@ variable to be set. The full invocation to run everything might ...@@ -97,7 +97,7 @@ variable to be set. The full invocation to run everything might
therefore look something like: therefore look something like:
```shell ```shell
$ FLUTTER_ROOT=~/path/to/flutter-sdk $ export FLUTTER_ROOT=~/path/to/flutter-sdk
$ flutter test --concurrency 1 $ flutter test --concurrency 1
``` ```
......
...@@ -139,6 +139,11 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -139,6 +139,11 @@ class FlutterPlugin implements Plugin<Project> {
private Properties localProperties private Properties localProperties
private String engineVersion private String engineVersion
/**
* Flutter Docs Website URLs for help messages.
*/
private final String kWebsiteDeploymentAndroidBuildConfig = 'https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration'
@Override @Override
void apply(Project project) { void apply(Project project) {
this.project = project this.project = project
...@@ -409,9 +414,12 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -409,9 +414,12 @@ class FlutterPlugin implements Plugin<Project> {
// Wait until the Android plugin loaded. // Wait until the Android plugin loaded.
pluginProject.afterEvaluate { pluginProject.afterEvaluate {
// Checks if there is a mismatch between the plugin compileSdkVersion and the project compileSdkVersion.
if (pluginProject.android.compileSdkVersion > project.android.compileSdkVersion) { if (pluginProject.android.compileSdkVersion > project.android.compileSdkVersion) {
project.logger.quiet("Warning: The plugin ${pluginName} requires Android SDK version ${pluginProject.android.compileSdkVersion.substring(8)}.") project.logger.quiet("Warning: The plugin ${pluginName} requires Android SDK version ${pluginProject.android.compileSdkVersion.substring(8)}.")
project.logger.quiet("For more information about build configuration, see $kWebsiteDeploymentAndroidBuildConfig.")
} }
project.android.buildTypes.all addEmbeddingDependencyToPlugin project.android.buildTypes.all addEmbeddingDependencyToPlugin
} }
} }
......
...@@ -410,7 +410,8 @@ final GradleHandledError minSdkVersion = GradleHandledError( ...@@ -410,7 +410,8 @@ final GradleHandledError minSdkVersion = GradleHandledError(
'The plugin ${minSdkVersionMatch?.group(3)} requires a higher Android SDK version.\n' 'The plugin ${minSdkVersionMatch?.group(3)} requires a higher Android SDK version.\n'
'$textInBold\n' '$textInBold\n'
"Note that your app won't be available to users running Android SDKs below ${minSdkVersionMatch?.group(2)}.\n" "Note that your app won't be available to users running Android SDKs below ${minSdkVersionMatch?.group(2)}.\n"
'Alternatively, try to find a version of this plugin that supports these lower versions of the Android SDK.', 'Alternatively, try to find a version of this plugin that supports these lower versions of the Android SDK.\n'
'For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration',
title: _boxTitle, title: _boxTitle,
); );
return GradleBuildStatus.exit; return GradleBuildStatus.exit;
...@@ -518,8 +519,8 @@ final GradleHandledError minCompileSdkVersionHandler = GradleHandledError( ...@@ -518,8 +519,8 @@ final GradleHandledError minCompileSdkVersionHandler = GradleHandledError(
required bool usesAndroidX, required bool usesAndroidX,
required bool multidexEnabled, required bool multidexEnabled,
}) async { }) async {
final Match? minSdkVersionMatch = _minCompileSdkVersionPattern.firstMatch(line); final Match? minCompileSdkVersionMatch = _minCompileSdkVersionPattern.firstMatch(line);
assert(minSdkVersionMatch?.groupCount == 1); assert(minCompileSdkVersionMatch?.groupCount == 1);
final File gradleFile = project.directory final File gradleFile = project.directory
.childDirectory('android') .childDirectory('android')
...@@ -529,7 +530,7 @@ final GradleHandledError minCompileSdkVersionHandler = GradleHandledError( ...@@ -529,7 +530,7 @@ final GradleHandledError minCompileSdkVersionHandler = GradleHandledError(
'${globals.logger.terminal.warningMark} Your project requires a higher compileSdkVersion.\n' '${globals.logger.terminal.warningMark} Your project requires a higher compileSdkVersion.\n'
'Fix this issue by bumping the compileSdkVersion in ${gradleFile.path}:\n' 'Fix this issue by bumping the compileSdkVersion in ${gradleFile.path}:\n'
'android {\n' 'android {\n'
' compileSdkVersion ${minSdkVersionMatch?.group(1)}\n' ' compileSdkVersion ${minCompileSdkVersionMatch?.group(1)}\n'
'}', '}',
title: _boxTitle, title: _boxTitle,
); );
......
...@@ -37,6 +37,8 @@ android { ...@@ -37,6 +37,8 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "{{androidIdentifier}}" applicationId "{{androidIdentifier}}"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
......
...@@ -45,6 +45,8 @@ android { ...@@ -45,6 +45,8 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "{{androidIdentifier}}" applicationId "{{androidIdentifier}}"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
......
...@@ -780,6 +780,8 @@ assembleProfile ...@@ -780,6 +780,8 @@ assembleProfile
"│ Note that your app won't be available to users running Android SDKs below 19. │\n" "│ Note that your app won't be available to users running Android SDKs below 19. │\n"
'│ Alternatively, try to find a version of this plugin that supports these lower versions of the │\n' '│ Alternatively, try to find a version of this plugin that supports these lower versions of the │\n'
'│ Android SDK. │\n' '│ Android SDK. │\n'
'│ For more information, see: │\n'
'│ https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration │\n'
'└───────────────────────────────────────────────────────────────────────────────────────────────┘\n' '└───────────────────────────────────────────────────────────────────────────────────────────────┘\n'
) )
); );
......
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