Kotlin Error 'unresolved reference' appears when trying to run Java Code from a Kotlin file

120 Views Asked by At

Referencing Problem when Java Class is used in Kotlin. There is the Java class Base32Decoder.java and code from this class is used in the Kotlin file hello.kt.

When I try to run Java code through a Kotlin file, an error occurs because of no reference could be established to the Java class Base32Decoder.

Error message:

hello.kt:4:25: error: unresolved reference: Base32Decoder

Base32Decoder Java class can't resolve the reference to it. Since this class is used inside the Kotlin file, the reference needs to work.

Code

fun main(args: Array<String>){
    val Base32Decoder = Base32Decoder()
   val rectangleArea: String = Base32Decoder.base32Decode("JBSWY3DPFQQFO33SNRSCC===")
   println("inside the Kotlin codes:" + rectangleArea)
}

How can I reference Java classes when I want to use Java code in Kotlin files?

0

There are 0 best solutions below