Skip to content

Engine JUnit tests don't support newer SDKs #38471

@mklim

Description

@mklim

The JUnit tests are using Robolectric 3.8. As mentioned in the README Robolectric 4+ uses the AndroidX libraries, and the engine sources use the deprecated android.support ones. See #23586. However we need to use Robolectric 4+ in order to test SDK 28+ methods. Currently the tests are compiling with SDK 29, but they only have the option to use SDK 16 at runtime. Just recently @shihaohong needed this to be able to test some SDK 29 specific code.

If we want to be able to test any code paths that use the new SDK 29 methods we'll need to upgrade Robolectric and any of its affected deps to the latest 4+ version and then add the SDK 29 android-all robolectric jar to our runtime dependencies. This may also require running Jetifier on flutter.jar after it's compiled and before the tests are run in order to avoid any AndroidX incompatibilities. I suspect we may be able to get away without using Jetifier in the immediate short term, but it would probably end up becoming a long term problem whenever we needed to put a class using android.support under test for the first time.

/cc @matthew-carroll @dnfield

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsdependency: androidAndroid team may need to help usengineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions