Are Java-8 features really API independant on Android?

Viewed 17

My application is using Gradle v7.5.1 (plugin v7.2.2) and I'm using some Java8 features in my code.

According to https://developer.android.com/studio/write/java8-support,I shouldn't have any problem with that:

When building your app using Android Gradle plugin 4.0.0 and higher, you can use a number of Java 8 language APIs without requiring a minimum API level for your app.

However, Crashlytics informs me that I do have a problem:

Fatal Exception: java.lang.NoSuchMethodError: No virtual method stream()Ljava/util/stream/Stream; in class Ljava/util/AbstractList; or its super classes (declaration of 'java.util.AbstractList' appears in /system/framework/core-libart.jar)

Indeed, some of my users are experiencing this error. At the moment I have limited feedback, the error happened on Samsung phones with Android 5 and Android 6 onboard.

Unlike what the doc says, is there a specific way I should handle Java8 features when developing Android apps?

NB: I'm an enthusiast dev maintaining a free app for students, please bear with me as I have no testing environment and limited debugging skills.

0 Answers
Related