I have a fairly simple block of code to clear a notification from the UI:
fun markNotificationRead(notificationId: String) {
mainHandler.post {
if (notifications.removeIf { it.id == notificationId }) {
notificationLiveData.value = notifications
}
}
}
I can’t reproduce this on my device but I get rare crashes on Firebase saying:
NoClassDefFoundError: com.example.service.WebSocket$markNotificationRead$1$1
com.example.service.WebSocket$markNotificationRead$1.run
It looks like $1.run is throwing the exception? Is my lambda not being added to the dex?
Look at the [documentation](ArrayList | Android Developers(java.util.function.Predicate<? super E>), removeIf was added to java 8 and in android was only available from api level 24.
Thanks! Adding the Guava library and using it instead did the trick. I was using the kotlin implementation of the array and assumed that they provided the 1.8 features in the library.