I have a Kotlin source file, but I want to translate it to Java.

How can I convert Kotlin to Java source?

Solution

In IntelliJ or Android Studio, you just have to do the following to get java code from kotlin:

  1. Menu>Tools>Kotlin>Show Kotlin Bytecode
  2. Click on the Decompile button
  3. Copy the java code

This question was reposted from Stack Overflow