Kotlin cannot access kotlin.jvm.functions.Function1 when calling kotlin function with java lambda
My problem got fixed when I configured Kotlin compiler and runtime for my Java module with the latest stable version (currently 1.3.30)
Just go to Tools > Kotlin > Configure Kotlin in Project > Android with Gradle and choose your Java module with Single module radio button selected then select your version and OK.
Another Solution:
If you have several modules in your android project, please make sure you have added the below config to every module that uses the kotlin:
Step(1)- Project build.gradle:
// Project build.gradle file.
buildscript {
ext.kotlin_version = '1.3.30'
...
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Step(2)- Inside each module using kotlin:
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
...
dependencies {
implementation "androidx.core:core-ktx:1.0.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Reference: Add Kotlin to an existing app