
When targeting the JVM, Kotlin produces Java compatible bytecode."īy looking at the left image, we can conclude that the compilation processes of Java and Kotlin are almost the same. If we check Kotlin’s FAQ, that is exactly what Kotlin compiler does. To be able to run on the JVM it needs to compile to Java byte-code. Kotlin code compilationīy definition, Kotlin is a statically-typed open-source programming language generating code that can run on the JVM. With that being said, we can conclude topic regarding Java code compilation. JIT (Just-In-Time) compiler- type of compiler which does the compilation during the execution of a program (compiles the app when user opens it).JVM (Java Virtual Machine)- engine which provides runtime environment for execution of Java code.Java byte-code - representation of Java assembly.Generally that is the whole process of running Java code, but I would also like to explain few of the mentioned terms. The machine code is then fed to the memory and executed by computer’s central processing unit.JVM understands byte-code and converts it into machine code, using JIT (Just-In-Time) compiler.Java byte-code file ( TestClass.class) ends up in JVM (Java Virtual Machine).Javac compiles Java source file into Java byte-code file as TestClass.class.TestClass.java is compiled by javac (Java compiler).The steps for compiling the given file will be the following: For demonstration purpose let’s say we have TestClass.java file which we want to run. In order for Java code to run, there are couple of steps which need to be done.

Therefor let’s familiarize ourselves with those two processes.

So the process of Android app compilation is based on the compilation process of Java and Kotlin code (aside from Android environment). Well, the goal of this article is to explain the compilation process of an Android app.Īs we all know, Android apps can be written in Java and Kotlin programming languages. Did you ever wonder what the process of compiling your Java/Kotlin code and running application on Android device look like? What happens under the hood?
