Converting Kotlin to Java

Saiteja Kolan picture Saiteja Kolan · Jun 17, 2018 · Viewed 20.9k times · Source

Can anyone help me about converting Kotlin code in Android Studio to Java?

I went through the below process:

Tools >> Kotlin>> Decompile Kotlin to Java

But the "Kotlin to Java" option is disabled. What should I do?

enter image description here

Answer

Onik picture Onik · Sep 23, 2018

Currently Tools >> Kotlin>> Decompile Kotlin to Java is enabled only for compiled Kotlin classes (.class, not .kt extension) located at app/build/tmp/kotlin-classes/ after a successful build.

A note to the @Uriel Frankel's workaround:

If Tools >> Kotlin >> Show Kotlin Bytecode >> Decompile button is disabled (or not shown) the Java Bytecode Decompiler plugin should be installed: Preferences >> Plugins >> search forJava Bytecode Decompiler` >> check the plugin & press OK.