HiveBrain v1.2.0
Get Started
← Back to all entries
snippetjavaCritical

How to convert a Kotlin source file to a Java source file

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
kotlinsourcehowjavaconvertfile

Problem

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

How can I convert Kotlin to Java source?

Solution

As @Vadzim said, in IntelliJ or Android Studio, you just have to do the following to get java code from kotlin:

  • Menu > Tools > Kotlin > Show Kotlin Bytecode



  • Click on the Decompile button



  • Copy the java code



Update:

With a recent version (1.2+) of the Kotlin plugin you also can directly do Menu > Tools > Kotlin -> Decompile Kotlin to Java.

Context

Stack Overflow Q#34957430, score: 547

Revisions (0)

No revisions yet.