Android Development Basics: How to add Kotlin to an existing Java Android project

Kotlin is pretty great. It’s got a whole bunch of useful language features, and the syntax is generally clean and simple. It’s also cross-platform, and the base language can compile to a whole bunch of different languages and platforms.
Kotlin for Java (called KotlinJVM) compiles to the same thing Java compiles to — JVM bytecode for pure Java, and whatever Android is using these days for its version of Java. This means code written in KotlinJVM has access to all existing Java and Android APIs, along with any Java classes, methods, and fields that are already in your app.
That compatibility works the other way around, too. Meaning, you can access Kotlin APIs from Java. The code might end up looking a little messy if you try to use more advanced features, but it’s possible.
This tutorial is going to go over how you can add Kotlin to an existing Android project that’s made in Java. It also assumes you’re using Android Studio. Before we get started though, you may want to familiarize yo…

Written By: Zachary Wander

Original Article: https://www.xda-developers.com/add-kotlin-to-app/

Leave a Comment