Scarlet
Scarlet copied to clipboard
Library platform check is not robust for Android
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.