Add Kotlin into an existing app

To gain skills and confidence using Kotlin, we recommend
a gradual approach:

Start by writing tests in Kotlin. Tests are
useful to check for code regression, and they add a level of confidence when
refactoring your code. Tests are especially useful when converting existing Java
code into Kotlin. Because tests are not bundled with your app during packaging,
they are a safe place to add Kotlin to the codebase.

Write new code in Kotlin. Before converting existing Java code to Kotlin, try
adding small pieces of new Kotlin code to your app.
Begin with a small class or top-level helper function. Be sure to add
the relevant annotations to the Kotlin code to ensure proper interoperability
with the Java code.

Begin by using the Android Studio code
converter which converts
the code in a Java file to Kotlin. You can also convert Java code pasted from
the clipboard into a Kotlin file.

Android APIs and Kotlin examples

Kotlin provides complete interoperability with the Java
language, so calling
the Android APIs often looks exactly like the matching Java code. Except now
you can combine those method calls with Kotlin's syntax features.

We're also working to make all Android API documentation available with
idiomatic Kotlin references. You can
find links to the available Kotlin references on the
Android reference overview.

Below are a few examples of what it looks like to call Android APIs in Kotlin,
compared to the same code in Java language: