Skip to content

Upgrade flutter/flutter to Roblectric 4.17 - #193369

Merged
auto-submit[bot] merged 6 commits into
flutter:masterfrom
jesswrd:rob-flut-to-37
Sep 29, 2026
Merged

auto-submit[bot] merged 6 commits into
flutter:masterfrom
jesswrd:rob-flut-to-37

Conversation

@jesswrd

@jesswrd jesswrd commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Upgrade flutter/flutter to Roblectric 4.17. Includes all neccessary engine updates too. This is the latest and only version of Robolectric that supports SDK 37.

Added a bunch of flags because JDK 17+ blocks reflective access to JDK internals by default. Starting with 4.17, Robolectric's test environment setup reflects into jdk.internal.access, so these are required. This is the flag set
recommended by Robolectric, see https://robolectric.org/getting-started/#running-with-java-17-and-higher.

Partially Addresses #189518

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

…e unit tests

JDK 17+ enforces strong encapsulation of JDK internals, so Robolectric
requires a set of --add-opens flags on the test JVM. Until now none of
the code paths exercised by the engine tests needed them, but starting
with Robolectric 4.17 the per-test environment setup
(AndroidTestEnvironment.setUpApplicationState ->
ApplicationSharedMemory.create -> FileDescriptorInterceptor) reflects
into jdk.internal.access.SharedSecrets. Without the flags, ~900 tests
fail with:

  IllegalAccessException: ... module java.base does not export
  jdk.internal.access to unnamed module

Add the full flag set recommended by Robolectric
(https://robolectric.org/getting-started/#running-with-java-17-and-higher)
so the suite keeps working across Robolectric upgrades and JDK 21/25.
These flags only affect the forked Gradle unit-test JVM.

This is a no-op for the current Robolectric 4.16 and is split out ahead
of the 4.17 bump.
Mockito 5.17.0 bundles Byte Buddy 1.17.5, which rejects Java 25 class
files. Running the engine Robolectric/JUnit suite on JDK 25 fails 1243
tests with:

  IllegalArgumentException: Java 25 (69) is not supported by the
  current version of Byte Buddy which officially supports Java 24 (68)

Mockito 5.20.0 bundles Byte Buddy 1.17.7, which supports Java 25. With
this change the suite passes on both JDK 21 (the DEPS JDK used by CI)
and JDK 25.
Robolectric 4.17 adds support for Android SDK 37:
https://github.com/robolectric/robolectric/releases/tag/robolectric-4.17

Update both the test runner build.gradle (used by CI via
testing/run_tests.py --type=java) and the IDE-support build.gradle,
which is kept in sync. Also fix the stale Robolectric version in the
test README.

The 4.17 breaking changes (removal of AndroidVersions, the
ShadowCameraCharacteristics.set signature change) do not affect any
engine tests. 4.17 requires the --add-opens JVM args added in a
previous commit.
Now that the engine uses Robolectric 4.17, which supports SDK 37,
run the embedding unit tests against API 37 by default
(robolectric.properties sdk=36 -> sdk=37).

All tests pass on JDK 21 and JDK 25.
@jesswrd
jesswrd requested a review from a team as a code owner September 25, 2026 20:26
@jesswrd
jesswrd requested review from camsim99 and removed request for a team September 25, 2026 20:26
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 25, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added platform-android Android applications specifically engine flutter/engine related. See also e: labels. team-android Owned by Android platform team labels Sep 25, 2026

@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 the Robolectric testing framework version from 4.16 to 4.17 across the Android shell platform files, and updates the referenced version in the unit testing README. It adds necessary JVM --add-opens arguments to the test runner's Gradle configuration to support reflective access required by Robolectric 4.17+ on JDK 17+. Additionally, Mockito is upgraded to version 5.20.0 to support JDK 25, and the Robolectric SDK target is updated to 37. There are no review comments to address.

@camsim99 camsim99 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.

LGTM

@jesswrd jesswrd added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 28, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 28, 2026
Merged via the queue into flutter:master with commit 6363ecb Sep 29, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 29, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Sep 29, 2026
flutter/flutter@c5a061b...55b8f88

2026-09-29 [email protected] [Android 17] Added Android 17 device to Firebase tests (flutter/flutter#193251)
2026-09-29 [email protected] [engine] Fix remaining `unawaited_futures` lints (flutter/flutter#193508)
2026-09-29 [email protected] shell: Rename first-frame tests AddFirstFrameCallback* (flutter/flutter#193418)
2026-09-28 [email protected] Enable `unawaited_futures` lint across the Flutter repository (flutter/flutter#193125)
2026-09-28 [email protected] Upgrade flutter/flutter to Roblectric 4.17 (flutter/flutter#193369)
2026-09-28 [email protected] [engine] Decode animation frames with alpha after an opaque first frame (flutter/flutter#193113)
2026-09-28 [email protected] Allow macOS tests to use macOS 15 or 26 (flutter/flutter#193317)
2026-09-28 [email protected] Cleanup DDC SDK build targets (flutter/flutter#193193)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-android Android applications specifically team-android Owned by Android platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants