Skip to content

Library platform check is not robust for Android #235

@sgjesse

Description

@sgjesse

The check for Java 8 platform use the presence of class java.util.Optional. When Java 8 platform is detected the method java.lang.reflect.Method.isDefault() is expected to be present.

On Android this might fail in certain situations, as library desugaring can introduce support for java.util.Optional on platforms where isDefault is not present causing java.lang.NoSuchMethodError, see R8 issue 342419066.

A better way to do this would be checking android/os/Build.VERSION#SDK_INT using reflection, and then have platform support for the relevant Android versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions