Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Bump min Android SDK to the version required at runtime #3894

Merged
merged 10 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.5

* Google Maps requires at least Android SDK 20.

## 2.0.4

* Unpin iOS GoogleMaps pod dependency version.
Expand Down
14 changes: 13 additions & 1 deletion packages/google_maps_flutter/google_maps_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ For more details, see [Getting started with Google Maps Platform](https://develo

### Android

Specify your API key in the application manifest `android/app/src/main/AndroidManifest.xml`:
1. Set the `minSdkVersion` in `android/app/build.gradle`:

```groovy
android {
defaultConfig {
minSdkVersion 20
}
}
```

This means that app will only be available for users that run Android SDK 20 or higher.

2. Specify your API key in the application manifest `android/app/src/main/AndroidManifest.xml`:

```xml
<manifest ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android {
compileSdkVersion 29

defaultConfig {
minSdkVersion 16
minSdkVersion 20
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {

defaultConfig {
applicationId "io.flutter.plugins.googlemapsexample"
minSdkVersion 16
minSdkVersion 20
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter
version: 2.0.4
version: 2.0.5

dependencies:
flutter:
Expand Down
5 changes: 5 additions & 0 deletions packages/webview_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.0.5

* WebView requires at least Android 19 if you are using
hybrid composition ([flutter/issues/59894](https://github.com/flutter/flutter/issues/59894)).

## 2.0.4

* Fix a bug where `allowsInlineMediaPlayback` is not respected on iOS.
Expand Down
14 changes: 13 additions & 1 deletion packages/webview_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ implementation. Note that on Android versions prior to Android 10 Hybrid Composi

### Using Hybrid Composition

To enable hybrid composition, set `WebView.platform = SurfaceAndroidWebView();` in `initState()`.
1. Set the `minSdkVersion` in `android/app/build.gradle`:

```groovy
android {
defaultConfig {
minSdkVersion 19
}
}
```

This means that app will only be available for users that run Android SDK 19 or higher.

2. To enable hybrid composition, set `WebView.platform = SurfaceAndroidWebView();` in `initState()`.
For example:

```dart
Expand Down
3 changes: 2 additions & 1 deletion packages/webview_flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ android {
compileSdkVersion 29

defaultConfig {
minSdkVersion 16
minSdkVersion 19
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

lintOptions {
disable 'InvalidPackage'
}
Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.flutter.plugins.webviewflutterexample"
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: webview_flutter
description: A Flutter plugin that provides a WebView widget on Android and iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/webview_flutter
version: 2.0.4
version: 2.0.5

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down
8 changes: 7 additions & 1 deletion script/tool/lib/src/create_all_plugins_app_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ class CreateAllPluginsAppCommand extends PluginCommand {

final StringBuffer newGradle = StringBuffer();
for (final String line in gradleFile.readAsLinesSync()) {
newGradle.writeln(line);
if (line.contains('minSdkVersion 16')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are creating "all plugins", which def contains google maps and web views, should we just never allow minSdkVersion to 16?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the test? Yup, this line changes the minSdkVersion. For all Flutter, see flutter/flutter#82000

// Android SDK 20 is required by Google maps.
// Android SDK 19 is required by WebView.
newGradle.writeln('minSdkVersion 20');
} else {
newGradle.writeln(line);
}
if (line.contains('defaultConfig {')) {
newGradle.writeln(' multiDexEnabled true');
} else if (line.contains('dependencies {')) {
Expand Down