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

Commit

Permalink
Bump min Android SDK to the version required at runtime (#3894)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Garcia authored May 17, 2021
1 parent 3995b43 commit 16b0144
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 9 deletions.
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.6

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

## 2.0.5

* Example app observes `uiMode`, so the WebView isn't reattached when the UI mode changes. (e.g. switching to Dark mode).
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.5
version: 2.0.6

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 @@ -81,7 +81,13 @@ class CreateAllPluginsAppCommand extends PluginCommand {

final StringBuffer newGradle = StringBuffer();
for (final String line in gradleFile.readAsLinesSync()) {
newGradle.writeln(line);
if (line.contains('minSdkVersion 16')) {
// 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

0 comments on commit 16b0144

Please sign in to comment.