How to Get Started with Kotlin in Android Studio


Introduction

Kotlin is now an official language on Android.

Kotlin is fully supported in Android Studio 3.0. You can convert entire Java files or Java code snippets into a Kotlin file.

Kotlin is an open source project under Apache 2.0.

Kotlin and Android

The Kotlin Programming Language on GitHub

Get Started with Kotlin on Android

Download Android Studio

Create a new project with Kotlin

On the first screen of the New Project wizard, check Include Kotlin support and click Next.




Just like Java files, the Kotlin files are saved in the src/main/java/ directory.

Add Kotlin to an existing project

  • In the wizard like New Android Activity that appears, select Kotlin for the Source language.
  • Click File > New > Kotlin File/Class to create a basic file.



By default, new Kotlin files are saved into src/main/java/.

張貼留言

0 留言