95533 min sdk error msgs enhancements (#99550)

This commit is contained in:
Tacca 2022-03-08 21:20:21 -03:00 committed by GitHub
parent 9240c9a02a
commit c8538873c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 5 deletions

View file

@ -97,7 +97,7 @@ variable to be set. The full invocation to run everything might
therefore look something like:
```shell
$ FLUTTER_ROOT=~/path/to/flutter-sdk
$ export FLUTTER_ROOT=~/path/to/flutter-sdk
$ flutter test --concurrency 1
```

View file

@ -139,6 +139,11 @@ class FlutterPlugin implements Plugin<Project> {
private Properties localProperties
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
void apply(Project project) {
this.project = project
@ -409,9 +414,12 @@ class FlutterPlugin implements Plugin<Project> {
// Wait until the Android plugin loaded.
pluginProject.afterEvaluate {
// Checks if there is a mismatch between the plugin compileSdkVersion and the project 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("For more information about build configuration, see $kWebsiteDeploymentAndroidBuildConfig.")
}
project.android.buildTypes.all addEmbeddingDependencyToPlugin
}
}

View file

@ -410,7 +410,8 @@ final GradleHandledError minSdkVersion = GradleHandledError(
'The plugin ${minSdkVersionMatch?.group(3)} requires a higher Android SDK version.\n'
'$textInBold\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,
);
return GradleBuildStatus.exit;
@ -518,8 +519,8 @@ final GradleHandledError minCompileSdkVersionHandler = GradleHandledError(
required bool usesAndroidX,
required bool multidexEnabled,
}) async {
final Match? minSdkVersionMatch = _minCompileSdkVersionPattern.firstMatch(line);
assert(minSdkVersionMatch?.groupCount == 1);
final Match? minCompileSdkVersionMatch = _minCompileSdkVersionPattern.firstMatch(line);
assert(minCompileSdkVersionMatch?.groupCount == 1);
final File gradleFile = project.directory
.childDirectory('android')
@ -529,7 +530,7 @@ final GradleHandledError minCompileSdkVersionHandler = GradleHandledError(
'${globals.logger.terminal.warningMark} Your project requires a higher compileSdkVersion.\n'
'Fix this issue by bumping the compileSdkVersion in ${gradleFile.path}:\n'
'android {\n'
' compileSdkVersion ${minSdkVersionMatch?.group(1)}\n'
' compileSdkVersion ${minCompileSdkVersionMatch?.group(1)}\n'
'}',
title: _boxTitle,
);

View file

@ -37,6 +37,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
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
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()

View file

@ -45,6 +45,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
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
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()

View file

@ -780,6 +780,8 @@ assembleProfile
"│ 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'
'│ Android SDK. │\n'
'│ For more information, see: │\n'
'│ https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration │\n'
'└───────────────────────────────────────────────────────────────────────────────────────────────┘\n'
)
);