Is there a way to use Java 8 functional interfaces on Android API below 24?
I can use retrolambda to enable lambdas with Android API level <24. So this works myButton.setOnClickListener(view -> Timber.d("Lambdas work!")); This also works Runnable runLater = () -> Timber.d("Lambdas work!"); runLater.run(); But this one does not Consumer<Integer> runLaterWithInt = (Integer i) -> Timber.d("i = " + i); runLaterWithInt.accept(3); The last one works on Android API Level 24, but on other devices this code causes a crash java.lang.NoClassDefFoundError: com.retrolambdatry.MainActivity$$Lambda$1 Instead of using retrolambda I tried to enable Java 8. First two code examples