Gradle + Kotlin = ⚡️ 🚀️

Kotlin + Gradle: a technology combination sure to foster developer happiness and productivity.

Why Gradle is best for Kotlin development

You can use the official Kotlin Gradle Plugin from JetBrains to compile your Kotlin code to target JVM, Android, and JS.

Gradle has features you cannot get from other build tools: A highly-customizable dependency resolution engine, visual build inspection and debugging tools, and many work avoidance mechanisms.

These and other reasons are why Kotlin itself is built with Gradle Kotlin DSL and Gradle is the official build tool for Android.

Gradle Kotlin DSL: use the language you ❤️ for your build too

You can bring the elegance and type-safety of Kotlin to your automation. Using Kotlin and a compatible IDE for your build scripts bestows quick documentation, completion, error highlighting, and refactoring.

Kotlin DSL v1.0 is available in Gradle 5.0. Read the Gradle Kotlin DSL Primer and follow the guide to migrating build scripts to Kotlin.

Keys to building happiness for Kotlin projects

"With great power comes great responsibility." These guides and references help you have the best experience building your Kotlin libraries and applications with Gradle:

  • Adhere to performance best practices — Builds can be more than an order of magnitude faster when incremental build, Kotlin build caching, and incremental annotation processing are used properly. Spend 1 hour following the performance guide to reap many hours saved.
  • Organize your sources for success — Following best practices on organizing Gradle projects not only sets healthy standards for discoverability, but also lets Gradle, Android, and Kotlin toolchains do less work (read: go faster).
  • Explore your build effectivelyWhy is my Kotlin code recompiled even with no changes? Where are these deprecation warnings coming from? There is no better tool for answering these questions than Build Scan™.
  • Get help — Search StackOverflow and Gradle docs at gradle.org/help and leverage the Gradle forums for community help.