Skip to content

Crashes on Android version 13 and older #70

@claired4l

Description

@claired4l

We just found that the library is not usable with Android version 13 and older since java.util.Scanner constructor with signature public Scanner (InputStream source, Charset charset) was only introduced in API level 34 .(https://developer.android.com/reference/java/util/Scanner#Scanner(java.io.InputStream,%20java.nio.charset.Charset))

and we have a call to it in ClasspathHelper.java:28
final var scanner = new Scanner(inputStream, StandardCharsets.UTF_8);

Maybe using the older constructor public Scanner (InputStream source, String charsetName) would work and make it backward compatible.
https://developer.android.com/reference/java/util/Scanner#Scanner(java.io.InputStream,%20java.lang.String)

Should I open a PR?


FATAL EXCEPTION: main Process: care.data4life.collect, PID: 15887 java.lang.NoSuchMethodError: No direct method <init>(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V in class Ljava/util/Scanner; or its super classes (declaration of 'java.util.Scanner' appears in /apex/com.android.art/javalib/core-oj.jar) at io.github.cdimascio.dotenv.internal.ClasspathHelper.loadFileFromClasspath(ClasspathHelper.java:28) at io.github.cdimascio.dotenv.internal.DotenvReader.read(DotenvReader.java:57) at io.github.cdimascio.dotenv.internal.DotenvParser.lines(DotenvParser.java:102) at io.github.cdimascio.dotenv.internal.DotenvParser.parse(DotenvParser.java:62) at io.github.cdimascio.dotenv.DotenvBuilder.load(DotenvBuilder.java:76) at io.github.cdimascio.dotenv.DslKt.dotenv(Dsl.kt:19) ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions