Skip to content

Commit b7aa480

Browse files
camsim99TytaniumDev
authored andcommitted
Update docs to support new Android version (flutter#152503)
Includes the following updates: - Spacing and capitalization fixes for readability - Corrects instructions on updating AVD dependencies - Links to engine docs to reduce redundancy
1 parent 88b151f commit b7aa480

File tree

1 file changed

+71
-47
lines changed

1 file changed

+71
-47
lines changed
Lines changed: 71 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,100 @@
1-
Support a new android API level flutter
2-
go/flutter-android-new-api-level
1+
# Support a new Android API level Flutter (go/flutter-android-new-api-level)
32

43
## Objective
5-
Provide a list of areas to consider and examples of former work for how to update flutter to support a new version of the android API. This happens every fall and flutter developers expect to build against the latest versions quickly after they are available.
4+
Provides a list of areas to consider and examples of former work for how to update Flutter to support a new version of the Android API. This happens every fall and Flutter developers expect to build against the latest versions quickly after they are available.
5+
66
### Overview
7-
#### Bump compile and target sdk versions in samples
8-
Samples, expecially add to app samples, represent apps that mirror the first types of users we see adopt new android apis.
9-
Example pr https://github.com/flutter/samples/pull/2368
7+
8+
#### Bump compile and target SDK versions in samples
9+
Samples, especially add to app samples, represent apps that mirror the first types of users we see adopt new Android APIs.
10+
11+
Example PR: https://github.com/flutter/samples/pull/2368
12+
1013
#### New Android features
11-
New android features can require a broad spectrum of work. Some will require nothing from flutter. Some will require a lot of work, such as the support for “back preview”. The android team generally needs to be aware and schedule work ahead of time.
14+
New Android features can require a broad spectrum of work. Some will require nothing from flutter. Some will require a lot of work, such as the support for “back preview”. The Android team generally needs to be aware and schedule work ahead of time.
15+
1216
#### Update Gradle/AGP support
13-
Sometimes newer versions of gradle are required to build without warning against a new version of android api. The warning looks like
17+
Sometimes newer versions of gradle are required to build without warning against a new version of Android API. The warning looks like
1418
```
1519
WARNING:We recommend using a newer Android Gradle plugin to use compileSdkPreview = "somenamedversion"
1620
This Android Gradle plugin (X.X.X) was tested up to compileSdk = XX
1721
```
1822
Bump the gradle version used in the engine.
1923

20-
2124
#### Update Robolectric
22-
Robolectric is a dependency that allows us to write unit tests that run on a local development machine against the android api surface without being on an android device.
25+
Robolectric is a dependency that allows us to write unit tests that run on a local development machine against the Android API surface without being on an Android device.
2326
Update what version of Robolectric we use in framework, engine and packages.
24-
Example packages: https://github.com/flutter/packages/pull/4018
25-
Example engine: https://github.com/flutter/engine/pull/42965
2627

28+
Example flutter/packages PR: https://github.com/flutter/packages/pull/4018, Example flutter/engine PR: https://github.com/flutter/engine/pull/42965
2729

2830
#### Update CI
2931

30-
Update emulator and/or physical device testing to use the new android api version for framework, engine and packages.
31-
Firebase test lab emulators and physical devices need support from the firebase team
32-
Run command `gcloud firebase test android models list` [documentation](https://firebase.google.com/docs/test-lab/android/available-testing-devices) to see available devices.
33-
Flutter managed Emulators (engine) require a new AVD image to one that supports the new api: https://flutter-review.googlesource.com/c/recipes/+/45049
34-
Example Framework: https://flutter-review.googlesource.com/c/recipes/+/45048
35-
Example Engine: https://github.com/flutter/engine/pull/42492
36-
Packages
37-
Modify https://github.com/flutter/packages/blob/main/.cirrus.yml “firebase_test_lab_script”
38-
Specifically the value for “--device” `./script/tool_runner.sh firebase-test-lab --device model=redfin,version=30 --exclude=script/configs/exclude_integration_android.yaml`
39-
https://github.com/flutter/packages/pull/4430
32+
Update emulator and/or physical device testing to use the new Android API version for framework, engine and packages.
33+
34+
Firebase test lab emulators and physical devices need support from the firebase team.
35+
Run command `gcloud firebase test Android models list` [documentation](https://firebase.google.com/docs/test-lab/Android/available-testing-devices) to see available devices.
36+
37+
Flutter managed emulators (engine) require a new AVD image to one that supports the new API. To do this, first locate the desired Android Virtual Device (AVD) from https://chrome-infra-packages.appspot.com/p/chromium/tools/android/avd/linux-amd64/. You should look at the most recently updated AVD and verify that it has the desired generic_android<API#>.textpb for the API version you are modified the engine to support. Then, determine its Instance Identifier.
38+
39+
In the framework, update the following `.ci.yaml` entry:
40+
41+
```yaml
42+
linux_android_emu:
43+
properties:
44+
contexts: >-
45+
[
46+
"android_virtual_device"
47+
]
48+
dependencies: >-
49+
[
50+
...
51+
{"dependency": "android_virtual_device", "version": "android_<API#>_google_apis_x64.textpb"},
52+
{"dependency": "avd_cipd_version", "version": "build_id:<Instance ID>"},
53+
]
54+
...
55+
```
56+
57+
In the engine, you may follow [Upgrading Engine's Android API version](https://github.com/flutter/flutter/blob/main/docs/platforms/android/Upgrading-Engine's-Android-API-version.md) to update the AVD dependency.
58+
59+
Example Framework PR: https://github.com/flutter/flutter/pull/152498, Example Engine PR: https://github.com/flutter/engine/pull/54186
60+
61+
In flutter/packages, modify https://github.com/flutter/packages/blob/main/.cirrus.yml “firebase_test_lab_script”
62+
Specifically the value for “--device” `./script/tool_runner.sh firebase-test-lab --device model=redfin,version=30 --exclude=script/configs/exclude_integration_Android.yaml`.
63+
64+
Example PR: https://github.com/flutter/packages/pull/4430
65+
4066
#### Update documentation
41-
Update documentation page to indicate the new api is tested
42-
https://docs.flutter.dev/reference/supported-platforms
67+
Update documentation page to indicate the new API is tested
68+
https://docs.flutter.dev/reference/supported-platforms.
69+
4370
#### Modify defaults
44-
In flutter/flutter:
45-
Update default compile sdk version and target sdk version to the new api value
46-
[Code here](../../../packages/flutter_tools/gradle/src/main/groovy/flutter.groovy)
71+
**In flutter/flutter:** Update default compile SDK version and target SDK version to the new API value.
72+
[Code here](../../../packages/flutter_tools/gradle/src/main/groovy/flutter.groovy).
4773
Follow comments in that file to update other locations that are assumed to be the same.
48-
Example bumping min sdk which is similar but different: https://github.com/flutter/flutter/pull/125515
49-
In flutter/buildroot:
50-
Upload new android sdk version to CIPD (steps at end of document)
51-
Update default android sdk version
52-
https://github.com/flutter/buildroot/blob/7984a08044b94bfb4c466ac881c6b56fdfe9148b/build/config/android/config.gni#L19
53-
In flutter/engine:
54-
Update android SDK in DEPS file
74+
Example bumping min SDK which is similar but different: https://github.com/flutter/flutter/pull/125515
75+
76+
**In flutter/buildroot:**
77+
78+
- Upload new Android SDK version to CIPD (steps at end of document)
79+
- Update default Android SDK version
80+
https://github.com/flutter/buildroot/blob/7984a08044b94bfb4c466ac881c6b56fdfe9148b/build/config/Android/config.gni#L19
81+
82+
**In flutter/engine:**
83+
84+
- Update Android SDK in DEPS file
5585
https://github.com/flutter/engine/blob/9289cb6a36aa86990e3ffe0f20324dafa38e7c11/DEPS#L731
56-
Update buildroot version in DEPS file to consume the changes in the flutter/buildroot steps above
86+
87+
- Update buildroot version in DEPS file to consume the changes in the flutter/buildroot steps above
5788
https://github.com/flutter/engine/blob/9289cb6a36aa86990e3ffe0f20324dafa38e7c11/DEPS#L260
58-
In flutter/packages
59-
Set examples to build with the new api.
89+
90+
**In flutter/packages:** Set examples to build with the new API.
91+
6092
#### Test “Integration Test” package
61-
Integration test is a package shipped in the flutter tool for running integration tests on flutter apps. Ensure that the integration test package has an example that targets the new api level on the most recent published stable version of the flutter tool.
93+
Integration test is a package shipped in the Flutter tool for running integration tests on Flutter apps. Ensure that the integration test package has an example that targets the new API level on the most recent published stable version of the Flutter tool.
6294

6395
#### Related documents
6496
[Emulators for Flutter Android Testing (PUBLICLY SHARED)](https://docs.google.com/document/d/10wYUcLcSTF4Epg2EUGoBqOkkOe4zxKHvYKjXFZAOgGs/edit?resourcekey=0-pltjPvEtVezXDADMbUwFHQ)
6597

6698
### Additional notes
6799
#### Upload new SDK version to CIPD and consume in buildroot
68-
69-
Make a fork of the [buildroot](https://github.com/flutter/buildroot) if you haven’t yet.
70-
Get CIPD temporary write access, if you don’t have it:
71-
Make a github issue describing that there is a new android release that needs to be uploaded to CIPD
72-
Go to [go/flutter-luci-cipd#requesting-writeread-access-to-cipd-packages](http://goto.google.com/flutter-luci-cipd#requesting-writeread-access-to-cipd-packages) and click request access on the hyperlinked page
73-
Fill out the justification with b/12345 - <your GitHub issue> (the form requires a buganizer link, and the addition of b/12345 satisfies this).
74-
Reach out to someone on the infra team to get your request approved
75-
Run the [create_cipd_packages.sh script](https://github.com/flutter/engine/blob/a2adaa39a2c35d1ab23394d550c9a7e50fe41fe9/tools/android_sdk/create_cipd_packages.sh) with your desired version tag (note that there is a .ci.yaml validation step that requires this version tag to be a combination of lowercase letters and numbers). The script pulls the version that will be uploaded from the packages.txt file in the same subdirectory.
76-
The remaining steps are to consume the changes in the buildroot, and then consume those buildroot changes in the engine.
100+
See [Upgrading Engine's Android API version](https://github.com/flutter/flutter/blob/main/docs/platforms/android/Upgrading-Engine's-Android-API-version.md) for instructions, as this work is also required to build the engine against the new Android version.

0 commit comments

Comments
 (0)