LoginSignup
10
15

More than 5 years have passed since last update.

【Android】KotlinからJavaへ変換(デコンパイル)する手順

Last updated at Posted at 2017-10-14

今更感ありますがKotlinからJavaへ変換(デコンパイル)する手順メモです。
昔はコマンドラインで変換する必要があったみたいですが今はGUIで簡単にできます。

環境

  • Android Studio: 2.3.3
  • Kotlin: 1.1.50

GUIでデコンパイル

tools > Kotlin > Show Kotlin Bytecode

Decompileボタン押下

そうするとファイル名.decompile.javaができます。

補足: CUIでデコンパイル

コンパイル

kotlinc foo.kt -include-runtime -d foo.jar

jarを解凍してclassファイルを取り出す

$ jar -xvf foo.jar

取り出したclassファイルをデコンパイル

$ jad -s java -d src -r **/*.class

参考

How to convert a kotlin source file to a java source file - Stack Overflow
https://stackoverflow.com/questions/34957430/how-to-convert-a-kotlin-source-file-to-a-java-source-file

10
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
15