java.lang.NoClassDefFoundError $$inlined$forEach$lambda$1 in Kotlin

After reading Dan Lew's post a couple days ago, I'll make a suggestion that this can be caused by using Map.forEach { k, v -> } method from Java 8, which may be unavailable in Android runtime.

You could try to use another forEach with the single entry parameter that comes from the Kotlin standard library:

mapOfreminders.forEach { (_, finalReminders) -> }

Here the parentheses are used to destructure entry parameter into two variables: ignored key and finalReminders value.


I encountered this problemjava.lang.NoClassDefFoundError on Android 6.0 and 6.0.1 by using

Map.forEach {key ,value -> }

this call java 8 api.

And then, I solved this problem by adding brackets to parameter:

Map.forEach {(key ,value) -> }

this call kotlin api