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
- Kotlin and Java can coexist in the same Android project seamlessly
- Gradle configuration requires kotlin-gradle-plugin and kotlin-stdlib dependencies
- IDE auto-converts Java files to Kotlin and reorganizes project structure
- Source folders need manual setup: create main/kotlin alongside main/java
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.
About This Article
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.
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.
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.