Skip to content

[Engine][Android] Fix Mockito dynamic agent loading warnings in Robolectric tests for JDK compatibility #189148

Closed

Description

@gmackall

When running Android engine Robolectric tests (e.g., ./flutter/testing/run_tests.py --type java), Mockito emits deprecation warnings when self-attaching the inline-mock-maker agent on newer JDK releases (JDK 21+):

Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build as described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3
WARNING: A Java agent has been loaded dynamically (/var/folders/4p/.../byteBuddyAgent...jar)
WARNING: Dynamic loading of agents will be disallowed by default in a future release

To ensure tests do not break when upgrading to future JDK releases where dynamic agent loading is disallowed by default, Mockito should be explicitly configured as a -javaagent in the test JVM arguments, or dynamic agent loading should be explicitly enabled.

Code Links:

Activity

  1. added
    in triagePresently being triaged by the triage team
    team-androidOwned by Android platform team
    engineflutter/engine related. See also e: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Jul 9, 2026
  2. added
    P1High-priority issues at the top of the work list
    P2Important issues not at the top of the work list
    and removed
    P1High-priority issues at the top of the work list
    on Jul 14, 2026
  3. added a commit that references this issue on Jul 22, 2026
    543e016
  4. github-actions commented on Aug 5, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  5. locked as resolved and limited conversation to collaborators on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listengineflutter/engine related. See also e: labels.team-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions