Unverified Commit 37a1aaf8 authored by Tacca's avatar Tacca Committed by GitHub

reads min/target sdk versions from localproperties (#98450)

parent 320d2cff
...@@ -29,6 +29,16 @@ apply plugin: 'com.android.application' ...@@ -29,6 +29,16 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
...@@ -48,8 +58,8 @@ android { ...@@ -48,8 +58,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 "dev.flutter.flutter_api_samples" applicationId "dev.flutter.flutter_api_samples"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -28,6 +28,16 @@ if (flutterVersionName == null) { ...@@ -28,6 +28,16 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
...@@ -38,8 +48,8 @@ android { ...@@ -38,8 +48,8 @@ android {
defaultConfig { defaultConfig {
applicationId "io.flutter.examples.flutter_view" applicationId "io.flutter.examples.flutter_view"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -28,6 +28,16 @@ if (flutterVersionName == null) { ...@@ -28,6 +28,16 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
...@@ -38,8 +48,8 @@ android { ...@@ -38,8 +48,8 @@ android {
defaultConfig { defaultConfig {
applicationId "io.flutter.examples.hello_world" applicationId "io.flutter.examples.hello_world"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -28,6 +28,16 @@ if (flutterVersionName == null) { ...@@ -28,6 +28,16 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
...@@ -39,8 +49,8 @@ android { ...@@ -39,8 +49,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 "com.example.image_list" applicationId "com.example.image_list"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -28,6 +28,16 @@ if (flutterVersionName == null) { ...@@ -28,6 +28,16 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
...@@ -38,8 +48,8 @@ android { ...@@ -38,8 +48,8 @@ android {
defaultConfig { defaultConfig {
applicationId "io.flutter.examples.layers" applicationId "io.flutter.examples.layers"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -28,6 +28,16 @@ if (flutterVersionName == null) { ...@@ -28,6 +28,16 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
...@@ -38,8 +48,8 @@ android { ...@@ -38,8 +48,8 @@ android {
defaultConfig { defaultConfig {
applicationId "io.flutter.examples.platform_channel" applicationId "io.flutter.examples.platform_channel"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
......
...@@ -28,6 +28,16 @@ if (flutterVersionName == null) { ...@@ -28,6 +28,16 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
...@@ -38,8 +48,8 @@ android { ...@@ -38,8 +48,8 @@ android {
defaultConfig { defaultConfig {
applicationId "io.flutter.examples.platform_view" applicationId "io.flutter.examples.platform_view"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -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 references 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
...@@ -300,7 +305,7 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -300,7 +305,7 @@ class FlutterPlugin implements Plugin<Project> {
localEngine = engineOut.name localEngine = engineOut.name
localEngineSrcPath = engineOut.parentFile.parent localEngineSrcPath = engineOut.parentFile.parent
} }
project.android.buildTypes.all this.&addFlutterDependencies project.android.buildTypes.all this.&addFlutterDependencies
} }
private static Boolean shouldShrinkResources(Project project) { private static Boolean shouldShrinkResources(Project project) {
...@@ -409,9 +414,33 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -409,9 +414,33 @@ class FlutterPlugin implements Plugin<Project> {
// Wait until the Android plugin loaded. // Wait until the Android plugin loaded.
pluginProject.afterEvaluate { pluginProject.afterEvaluate {
Boolean showBuildConfigurationMessage = false
// 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)}.")
showBuildConfigurationMessage = true
}
// Checks if there is a mismatch between the plugin minSdkVersion and the project minSdkVersion.
if(pluginProject.android.defaultConfig?.minSdkVersion?.apiLevel > project.android.defaultConfig?.minSdkVersion?.apiLevel) {
project.logger.quiet("Warning: The plugin ${pluginName} requires minSdkVersion ${pluginProject.android.defaultConfig?.minSdkVersion?.apiLevel}.")
showBuildConfigurationMessage = true
if (!resolveProperty("flutter.minSdkVersion", null)) {
project.logger.quiet("flutter.minSdkVersion not found on ${project.projectDir.parentFile}${File.separator}local.properties, consider adding it. Using ${project.android.defaultConfig.minSdkVersion.apiLevel} as default.")
}
// Additionally checks if the targetSdkVersion was set.
if (!resolveProperty("flutter.targetSdkVersion", null)) {
project.logger.quiet("flutter.targetSdkVersion not found on ${project.projectDir.parentFile}${File.separator}local.properties, consider adding it. Using ${project.android.defaultConfig.targetSdkVersion.apiLevel} as default.")
}
} }
if (showBuildConfigurationMessage) {
project.logger.quiet("For more information about build configuration, see $kWebsiteDeploymentAndroidBuildConfig.")
}
project.android.buildTypes.all addEmbeddingDependencyToPlugin project.android.buildTypes.all addEmbeddingDependencyToPlugin
} }
} }
......
...@@ -390,27 +390,24 @@ final GradleHandledError minSdkVersion = GradleHandledError( ...@@ -390,27 +390,24 @@ final GradleHandledError minSdkVersion = GradleHandledError(
required bool usesAndroidX, required bool usesAndroidX,
required bool multidexEnabled, required bool multidexEnabled,
}) async { }) async {
final File gradleFile = project.directory final File localPropertiesFile = project.directory
.childDirectory('android') .childDirectory('android')
.childDirectory('app') .childFile('local.properties');
.childFile('build.gradle');
final Match? minSdkVersionMatch = _minSdkVersionPattern.firstMatch(line); final Match? minSdkVersionMatch = _minSdkVersionPattern.firstMatch(line);
assert(minSdkVersionMatch?.groupCount == 3); assert(minSdkVersionMatch?.groupCount == 3);
final String textInBold = globals.logger.terminal.bolden( final String textInBold = globals.logger.terminal.bolden(
'Fix this issue by adding the following to the file ${gradleFile.path}:\n' 'Fix this issue by adding the following to the file ${localPropertiesFile.path}:\n'
'android {\n' '\n'
' defaultConfig {\n' 'flutter.minSdkVersion=${minSdkVersionMatch?.group(2)}\n'
' minSdkVersion ${minSdkVersionMatch?.group(2)}\n'
' }\n'
'}\n'
); );
globals.printBox( globals.printBox(
'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 +515,8 @@ final GradleHandledError minCompileSdkVersionHandler = GradleHandledError( ...@@ -518,8 +515,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 +526,7 @@ final GradleHandledError minCompileSdkVersionHandler = GradleHandledError( ...@@ -529,7 +526,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,
); );
......
...@@ -25,6 +25,16 @@ apply plugin: 'com.android.application' ...@@ -25,6 +25,16 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
...@@ -37,8 +47,8 @@ android { ...@@ -37,8 +47,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}}"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -25,6 +25,16 @@ apply plugin: 'com.android.application' ...@@ -25,6 +25,16 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
...@@ -45,8 +55,8 @@ android { ...@@ -45,8 +55,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}}"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -26,6 +26,16 @@ if (flutterVersionName == null) { ...@@ -26,6 +26,16 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
group '{{androidIdentifier}}' group '{{androidIdentifier}}'
version '1.0' version '1.0'
...@@ -39,8 +49,8 @@ android { ...@@ -39,8 +49,8 @@ android {
} }
defaultConfig { defaultConfig {
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -2479,7 +2479,7 @@ void main() { ...@@ -2479,7 +2479,7 @@ void main() {
expect(env['flutter'].allows(Version(2, 4, 9)), false); expect(env['flutter'].allows(Version(2, 4, 9)), false);
}); });
testUsingContext('default app uses flutter default versions', () async { testUsingContext('default app uses local properties or flutter default versions', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
...@@ -2493,7 +2493,8 @@ void main() { ...@@ -2493,7 +2493,8 @@ void main() {
expect(buildContent.contains('compileSdkVersion flutter.compileSdkVersion'), true); expect(buildContent.contains('compileSdkVersion flutter.compileSdkVersion'), true);
expect(buildContent.contains('ndkVersion flutter.ndkVersion'), true); expect(buildContent.contains('ndkVersion flutter.ndkVersion'), true);
expect(buildContent.contains('targetSdkVersion flutter.targetSdkVersion'), true); expect(buildContent.contains('minSdkVersion flutterMinSdkVersion'), true);
expect(buildContent.contains('targetSdkVersion flutterTargetSdkVersion'), true);
}); });
testUsingContext('Linux plugins handle partially camel-case project names correctly', () async { testUsingContext('Linux plugins handle partially camel-case project names correctly', () async {
......
...@@ -770,16 +770,15 @@ assembleProfile ...@@ -770,16 +770,15 @@ assembleProfile
'\n' '\n'
'┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐\n' '┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐\n'
'│ The plugin webview_flutter requires a higher Android SDK version. │\n' '│ The plugin webview_flutter requires a higher Android SDK version. │\n'
'│ Fix this issue by adding the following to the file /android/app/build.gradle: │\n' '│ Fix this issue by adding the following to the file /android/local.properties: │\n'
'│ android { │\n' '│ │\n'
'│ defaultConfig { │\n' '│ flutter.minSdkVersion=19 │\n'
'│ minSdkVersion 19 │\n'
'│ } │\n'
'│ } │\n'
'│ │\n' '│ │\n'
"│ 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'
) )
); );
......
...@@ -28,6 +28,16 @@ if (flutterVersionName == null) { ...@@ -28,6 +28,16 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = flutter.minSdkVersion
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = flutter.targetSdkVersion
}
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
...@@ -39,8 +49,8 @@ android { ...@@ -39,8 +49,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 "com.example.integration_test_example" applicationId "com.example.integration_test_example"
minSdkVersion flutter.minSdkVersion minSdkVersion flutterMinSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
......
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