Skip to content

[devicelab] Read AssetManifest.bin from the APK in flavors_test - #196736

Merged
reidbaker merged 2 commits into
flutter:masterfrom
reidbaker-agent:devicelab-flavors-apk-asset-manifest
Nov 17, 2026
Merged

reidbaker merged 2 commits into
flutter:masterfrom
reidbaker-agent:devicelab-flavors-apk-asset-manifest

Conversation

@reidbaker-agent

Copy link
Copy Markdown
Contributor

flavors_test read AssetManifest.bin from AGP's intermediate directory,
build/app/intermediates/assets/paidDebug/mergePaidDebugAssets/flutter_assets/.

Since #196465, the Flutter Gradle Plugin adds its assets with a transform of
SingleArtifact.ASSETS, so AGP's merge<Variant>Assets output no longer holds
flutter_assets. The test then failed with PathNotFoundException, even though
the install succeeded and the APK has the assets. The failure was consistent, so
it was not flaky.

This change reads assets/flutter_assets/AssetManifest.bin from the built APK,
build/app/outputs/flutter-apk/app-paid-debug.apk, with package:archive
(devicelab already depends on it). The test no longer depends on AGP
intermediate paths, which are not a stable API.

Affected postsubmit targets (both run flavors_test):

  • Linux_pixel_7pro flavors_test
  • Windows_mokey flavors_test_win

Fixes #196735

Pre-launch Checklist

This PR changes a test only.

flavors_test read AssetManifest.bin from AGP's merge<Variant>Assets
intermediate directory. Since flutter#196465, the Flutter Gradle Plugin adds
its assets with a transform of SingleArtifact.ASSETS, so that directory
no longer holds flutter_assets and the test failed with
PathNotFoundException. Read the manifest from the built APK instead,
which does not depend on AGP intermediates.

Fixes flutter#196735

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates flavors_test.dart to extract and read the asset manifest directly from the installed APK file using ZipDecoder instead of an intermediate build directory. A review comment suggests avoiding a direct cast of the archive file content to Uint8List to prevent potential runtime TypeErrors, recommending a safe conversion from List<int> instead.

package:archive 3.x types ArchiveFile.content as dynamic, and a
decompressed entry is only guaranteed to be a List<int>.
@reidbaker reidbaker added the CICD Run CI/CD label Nov 16, 2026
@mboetger mboetger added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2026
@reidbaker reidbaker added the emergency Jump the queue; land PR in front of all others; only use for emergencies label Nov 17, 2026
@flutter-dashboard

Copy link
Copy Markdown

Detected the emergency label.

If you add the autosubmit label, the bot will wait until all presubmits pass but ignore the tree status, allowing fixes for tree breakages while still validating that they don't break any existing presubmits.

The "Merge" button is also unlocked. To bypass presubmits as well as the tree status, press the GitHub "Add to Merge Queue".

@reidbaker

Copy link
Copy Markdown
Member

Emergency added as this is a fix forward for the post submits that started failing.

@reidbaker
reidbaker added this pull request to the merge queue Nov 17, 2026
Merged via the queue into flutter:master with commit 2b91459 Nov 17, 2026
29 checks passed
@reidbaker
reidbaker deleted the devicelab-flavors-apk-asset-manifest branch November 17, 2026 02:07
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 17, 2026
flutter/flutter@d8bd864...2f09f96

2026-11-17 [email protected] Analyze every flutter create template, and fix the package_ffi lint (flutter/flutter#196165)
2026-11-17 [email protected] Roll Dart SDK from 50debf3c9757 to 26e38955d9d4 (3 revisions) (flutter/flutter#196772)
2026-11-17 [email protected] Manual roll ICU from b09986242cfb to d3c612f44146 (1 revision) (flutter/flutter#196713)
2026-11-17 [email protected] Roll Skia from 4f6b3a8d8565 to 503a380ebecc (19 revisions) (flutter/flutter#196768)
2026-11-17 [email protected] iOS: Don't mock UIView animations in keyboard spring animation test (flutter/flutter#196755)
2026-11-17 [email protected] [flutter_tools] Preserve index.html across --web-content-hash transitions (flutter/flutter#196491)
2026-11-17 [email protected] Fix TextStyle background color fade-out when lerping to null (flutter/flutter#196153)
2026-11-17 [email protected] Update desktop engine TESTOWNERS (flutter/flutter#196732)
2026-11-17 [email protected] [flutter_tools] Do not copy app-only build type properties onto library plugins (flutter/flutter#196692)
2026-11-17 [email protected] [flutter_tools] Remove service and runner ambient context getters (flutter/flutter#196571)
2026-11-17 [email protected] Bump customer tests (flutter/flutter#196740)
2026-11-17 [email protected] Take customer_testing_flame out of bringup (flutter/flutter#196570)
2026-11-17 [email protected] [devicelab] Read AssetManifest.bin from the APK in flavors_test (flutter/flutter#196736)
2026-11-17 [email protected] [flutter_tools] Fix flaky tool_tests_general by moving spawnUri tests to integration shard (flutter/flutter#195999)
2026-11-17 [email protected] Roll Dart SDK from 3e069c6fdbde to 50debf3c9757 (2 revisions) (flutter/flutter#196706)
2026-11-16 [email protected] [web] Record build finish synchronously in renderScene and fix dropped frame timings (flutter/flutter#195947)
2026-11-16 [email protected] Do not reveal obscured character when input is rejected by inputFormatters (flutter/flutter#195022)
2026-11-16 [email protected] Cla draft follow up: add waiting for response (flutter/flutter#196686)
2026-11-16 [email protected] Roll pub packages (flutter/flutter#196684)
2026-11-16 [email protected] Roll Packages from 015df97 to 4c6a7d3 (8 revisions) (flutter/flutter#196681)
2026-11-16 [email protected] Skip Vulkan impeller_unittests on macOS (flutter/flutter#196282)
2026-11-16 [email protected] Move the task runners out of Flutter Engine (flutter/flutter#196267)
2026-11-16 [email protected] [FGP] Add Flutter assets after AGP's asset merge so dotfiles are pack… (flutter/flutter#196465)
2026-11-16 [email protected] iOS: Add Obj-C model for platform view composition params (flutter/flutter#196498)
2026-11-16 [email protected] [Windows] Normalize Shift key messages with a non-standard scan code (flutter/flutter#193675)
2026-11-16 [email protected] Roll Skia from 118eaff3deb4 to 4f6b3a8d8565 (3 revisions) (flutter/flutter#196672)
2026-11-16 [email protected] Roll Dart SDK from c91e8b6674e2 to 3e069c6fdbde (4 revisions) (flutter/flutter#196669)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit Bot pushed a commit that referenced this pull request Nov 18, 2026
… are packaged (#196721)

### Issue Link:
#196444 original issue
and #196735 post submit failure that turned the tree red

Companion beta cherry-pick: #196747

### Impact Description:
[#192488](#192488), part of the migration to AGP's public Variant API, changed how the Flutter Gradle Plugin adds Flutter assets to an Android build. It shipped in 3.50.0 and in the current beta, 3.51.0-0.1.pre. Up to 3.47, a Gradle `Copy` task copied Flutter assets into the merged assets with Gradle's default excludes. Since #192488, they are registered as a generated assets source directory (`variant.sources.assets.addGeneratedSourceDirectory`).

AGP filters asset source directories with its `ignoreAssetsPattern`, which has a different default from Gradle's. That pattern drops files whose names start with `.` (such as `.env`) and folders whose names start with `_` (such as `_private/`). On 3.50.0 and 3.51.0-0.1.pre, Android builds silently leave out assets declared in `pubspec.yaml` that load on iOS, on web, and in 3.47. At runtime, `rootBundle.load` fails with "Unable to load asset". This affects production apps that ship a `.env` file, for example with `flutter_dotenv`. The build gives no warning, so developers find out only when the app runs.

This cherry-pick, [#196465](#196465), adds Flutter's assets as a transform of AGP's merged assets (`SingleArtifact.ASSETS`) after AGP's filtering, using a Gradle copy spec. That restores the set of files that 3.47 packaged while staying on the public Variant API.

### Changelog Description:
[flutter/196444] When building for Android with Flutter 3.50.0, assets whose names start with a dot (such as `.env`) or an underscore folder were silently left out of the APK or AAB which caused a runtime failure.

### Workaround:
Rename the affected assets and folders so they don't start with `.` or `_`, or stay on Flutter 3.47.

### Risk:
What is the risk level of this cherry-pick?

### Test Coverage:
Are you confident that your fix is well-tested by automated tests?

### Validation Steps:
1. Run `flutter create app`, add `assets/.env` and `assets/_private/file.txt` to `pubspec.yaml`, and load them with `rootBundle`.
2. Run `flutter build apk`, then `unzip -l build/app/outputs/flutter-apk/app-release.apk | grep flutter_assets`. Both files are listed.
3. The integration test `android_gradle_asset_merging_test.dart` and the `CopyFlutterAssetsTaskTest` unit tests cover dotfiles, Gradle default excludes, stale-file removal, and collisions.

### Cherry-pick conflict resolution:
`FlutterPlugin.kt` and `FlutterPluginTest.kt` conflicted. The 3.50 branch had a guard that threw a `GradleException` when AGP did not expose `variant.sources.assets`, plus a unit test for it. #196465 replaces that code path with a transform on `SingleArtifact.ASSETS`, so `sources.assets` is no longer used. The resolution takes #196465's version, which removes the guard and its test, matching master. The Flutter Gradle Plugin unit tests pass on this branch.

### Bundled test fix:
This CP also includes the devicelab `flavors_test` fix from [#196736](#196736) (`2b91459d5fe`), which fixes [#196735](#196735). `flavors_test` read `AssetManifest.bin` from AGP's `merge<Variant>Assets` intermediate folder, which no longer contains Flutter's assets after #196465 moves them to a `SingleArtifact.ASSETS` transform. The app still builds and installs; the test now reads `AssetManifest.bin` from the built APK. Without this fix, `Linux_pixel_7pro flavors_test` and `Windows_mokey flavors_test_win` (`presubmit: false` in `.ci.yaml`) would fail in `flutter-3.50-candidate.0` postsubmit.
auto-submit Bot pushed a commit that referenced this pull request Nov 18, 2026
…re packaged (#196747)

### Issue Link:
#196444

Bundled test fix for #196735 (postsubmit failure; see below).
Companion stable cherry-pick: #196721

### Impact Description:
[#192488](#192488), part of the migration to AGP's public Variant API, changed how the Flutter Gradle Plugin adds Flutter assets to an Android build. It shipped in 3.50.0 and in the current beta, 3.51.0-0.1.pre. Up to 3.47, a Gradle `Copy` task copied Flutter assets into the merged assets with Gradle's default excludes. Since #192488, they are registered as a generated assets source directory (`variant.sources.assets.addGeneratedSourceDirectory`).

AGP filters asset source directories with its `ignoreAssetsPattern`, which has a different default from Gradle's. That pattern drops files whose names start with `.` (such as `.env`) and folders whose names start with `_` (such as `_private/`). On 3.50.0 and 3.51.0-0.1.pre, Android builds silently leave out assets declared in `pubspec.yaml` that load on iOS, on web, and in 3.47. At runtime, `rootBundle.load` fails with "Unable to load asset". This affects production apps that ship a `.env` file, for example with `flutter_dotenv`. The build gives no warning, so developers find out only when the app runs.

This cherry-pick, [#196465](#196465), adds Flutter's assets as a transform of AGP's merged assets (`SingleArtifact.ASSETS`) after AGP's filtering, using a Gradle copy spec. That restores the set of files that 3.47 packaged while staying on the public Variant API.

### Changelog Description:
[flutter/196444] When building for Android, assets declared in `pubspec.yaml` whose names start with `.` (such as `.env`), or inside folders whose names start with `_`, are silently omitted from the APK and fail to load at runtime.

### Workaround:
Rename the affected assets and folders so they don't start with `.` or `_`, or stay on Flutter 3.47.

### Risk:
What is the risk level of this cherry-pick?

### Test Coverage:
Are you confident that your fix is well-tested by automated tests?

### Validation Steps:
1. Run `flutter create app`, add `assets/.env` and `assets/_private/file.txt` to `pubspec.yaml`, and load them with `rootBundle`.
2. Run `flutter build apk`, then `unzip -l build/app/outputs/flutter-apk/app-release.apk | grep flutter_assets`. Both files are listed.
3. The integration test `android_gradle_asset_merging_test.dart` and the `CopyFlutterAssetsTaskTest` unit tests cover dotfiles, Gradle default excludes, stale-file removal, and collisions.

### Bundled test fix:
This CP also includes the devicelab `flavors_test` fix from [#196736](#196736) (`2b91459d5fe`), which fixes [#196735](#196735). `flavors_test` read `AssetManifest.bin` from AGP's `merge<Variant>Assets` intermediate folder, which no longer contains Flutter's assets after #196465 moves them to a `SingleArtifact.ASSETS` transform. The app still builds and installs; the test now reads `AssetManifest.bin` from the built APK. Without this fix, `Linux_pixel_7pro flavors_test` and `Windows_mokey flavors_test_win` (`presubmit: false` in `.ci.yaml`) would fail in `flutter-3.51-candidate.0` postsubmit.
jose-pr pushed a commit to Boriken-Dev/flutter that referenced this pull request Nov 23, 2026
… are packaged (#196721)

### Issue Link:
flutter/flutter#196444 original issue
and flutter/flutter#196735 post submit failure that turned the tree red

Companion beta cherry-pick: flutter/flutter#196747

### Impact Description:
[#192488](flutter/flutter#192488), part of the migration to AGP's public Variant API, changed how the Flutter Gradle Plugin adds Flutter assets to an Android build. It shipped in 3.50.0 and in the current beta, 3.51.0-0.1.pre. Up to 3.47, a Gradle `Copy` task copied Flutter assets into the merged assets with Gradle's default excludes. Since #192488, they are registered as a generated assets source directory (`variant.sources.assets.addGeneratedSourceDirectory`).

AGP filters asset source directories with its `ignoreAssetsPattern`, which has a different default from Gradle's. That pattern drops files whose names start with `.` (such as `.env`) and folders whose names start with `_` (such as `_private/`). On 3.50.0 and 3.51.0-0.1.pre, Android builds silently leave out assets declared in `pubspec.yaml` that load on iOS, on web, and in 3.47. At runtime, `rootBundle.load` fails with "Unable to load asset". This affects production apps that ship a `.env` file, for example with `flutter_dotenv`. The build gives no warning, so developers find out only when the app runs.

This cherry-pick, [#196465](flutter/flutter#196465), adds Flutter's assets as a transform of AGP's merged assets (`SingleArtifact.ASSETS`) after AGP's filtering, using a Gradle copy spec. That restores the set of files that 3.47 packaged while staying on the public Variant API.

### Changelog Description:
[flutter/196444] When building for Android with Flutter 3.50.0, assets whose names start with a dot (such as `.env`) or an underscore folder were silently left out of the APK or AAB which caused a runtime failure.

### Workaround:
Rename the affected assets and folders so they don't start with `.` or `_`, or stay on Flutter 3.47.

### Risk:
What is the risk level of this cherry-pick?

### Test Coverage:
Are you confident that your fix is well-tested by automated tests?

### Validation Steps:
1. Run `flutter create app`, add `assets/.env` and `assets/_private/file.txt` to `pubspec.yaml`, and load them with `rootBundle`.
2. Run `flutter build apk`, then `unzip -l build/app/outputs/flutter-apk/app-release.apk | grep flutter_assets`. Both files are listed.
3. The integration test `android_gradle_asset_merging_test.dart` and the `CopyFlutterAssetsTaskTest` unit tests cover dotfiles, Gradle default excludes, stale-file removal, and collisions.

### Cherry-pick conflict resolution:
`FlutterPlugin.kt` and `FlutterPluginTest.kt` conflicted. The 3.50 branch had a guard that threw a `GradleException` when AGP did not expose `variant.sources.assets`, plus a unit test for it. #196465 replaces that code path with a transform on `SingleArtifact.ASSETS`, so `sources.assets` is no longer used. The resolution takes #196465's version, which removes the guard and its test, matching master. The Flutter Gradle Plugin unit tests pass on this branch.

### Bundled test fix:
This CP also includes the devicelab `flavors_test` fix from [#196736](flutter/flutter#196736) (`2b91459d5fe`), which fixes [#196735](flutter/flutter#196735). `flavors_test` read `AssetManifest.bin` from AGP's `merge<Variant>Assets` intermediate folder, which no longer contains Flutter's assets after #196465 moves them to a `SingleArtifact.ASSETS` transform. The app still builds and installs; the test now reads `AssetManifest.bin` from the built APK. Without this fix, `Linux_pixel_7pro flavors_test` and `Windows_mokey flavors_test_win` (`presubmit: false` in `.ci.yaml`) would fail in `flutter-3.50-candidate.0` postsubmit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD emergency Jump the queue; land PR in front of all others; only use for emergencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tree is red on Linux_pixel_7pro flavors_test

3 participants