Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library platform check is not robust for Android #235

Open
sgjesse opened this issue May 24, 2024 · 0 comments
Open

Library platform check is not robust for Android #235

sgjesse opened this issue May 24, 2024 · 0 comments

Comments

@sgjesse
Copy link

sgjesse commented May 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant