HomeAndroidAndroid vs Desktop App Kotlin Compilation Course of

Android vs Desktop App Kotlin Compilation Course of


Have you ever ever puzzled what occurs while you compile your Kotlin supply code?

The Kotlin Compiler would not convert your code to the machine code straight but it surely converts your code to bytecode as a substitute. Then, the Kotlin Interpreter/Digital Machine converts the bytecode to machine code throughout run-time/set up time.

Java Digital Machine (JVM)

Within the desktop app, the Kotlin interpreter is named Java Digital machine (JVM).

The JVM compiles the Java bytecode(*.class) to machine code when the app is launched. That is referred to as the Simply-in-time (JIT) compilation.

Dalvik Digital Machine (DVM)

Within the Android app, the Kotlin Interpreter is named Dalvik Digital Machine (DVM). It’s much like JVM besides it would not learn in Java Bytecode however Dalvik bytecode.

So there’s one further layer the place the DEX Compiler (DX) compiles the Java bytecode into Dalvik bytecode(*.dex). Then, Dalvik Digital Machine (DVM) compiles the Dalvik bytecode into machine code when the app is launched. So the DVM can also be a Simply-in-time compilation.

Android Runtime (ART)

After Android KitKat / Model 4.4 / API Degree 19 was launched in 2013, the Dalvik Digital Machine (DVM) is changed by Android Runtime(ART).

ART is much like DVM besides it compiles the Dalvik bytecode to machine code throughout app set up. That is referred to as the Forward-of-time compilation. The profit is it runs quicker throughout app launching on the expense of executable file measurement.

Conclusion

Properly, that is only a high-level diagram to point out the Android app compilation course of. I used to be not utterly conscious of this compilation course of earlier than, which I consider is an excellent vital idea for all Android app builders to know.

For extra particulars about ART (which you need not know), you possibly can confer with the official documentation right here.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments