Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin cannot access kotlin.jvm.functions.Function1 when calling kotlin function with java lambda

I am trying to call the following Kotlin function from Java

override fun First(list: LinqList<ElementType>, condition: (ElementType) -> Boolean) : ElementType

like this

int first = list.First(list,(x) -> x == 5);

but i get the following error

Error java: cannot access kotlin.jvm.functions.Function1
  class file for kotlin.jvm.functions.Function1 not found

I have tried googling it but i can not find the answer anywhere

Thanks in advance

like image 428
06needhamt Avatar asked Feb 02 '16 19:02

06needhamt


1 Answers

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.

like image 86
Sdghasemi Avatar answered Sep 22 '22 11:09

Sdghasemi