Kotlin Blog Aug 26, 2013

Working With Kotlin In Android Studio

Article Summary

JetBrains made history in 2013 by bringing Kotlin to Android Studio for the first time. This walkthrough from the early days shows just how far Android development has come.

This foundational article from JetBrains documents the initial integration of Kotlin into Android Studio with the M6 release. It covers the complete setup process, from plugin installation to running your first Kotlin-powered Android app, establishing patterns that would shape modern Android development.

Key Takeaways

Critical Insight

This early integration guide laid the groundwork for Kotlin becoming Android's preferred language, showing developers how to adopt it incrementally alongside existing Java code.

The article reveals a clever IDE feature that automatically detects Kotlin files and prompts you to reorganize your project structure.

About This Article

Problem

When Android projects used Gradle as their build system, Kotlin files weren't automatically recognized in the default main/java folder structure. Developers needed a way to specify where their Kotlin source code was located.

Solution

JetBrains added sourceSets configuration to the build.gradle file. Developers could now explicitly define main.java.srcDirs += 'src/main/kotlin' to mark the kotlin folder as a source root in Android Studio.

Impact

Once this gradle configuration was in place, Android Studio automatically marked the main/kotlin folder as a Source Root. Kotlin projects could then build and compile without requiring manual IDE adjustments.