Kotlin 1.2.50 is out!

We’re happy to announce the release of Kotlin 1.2.50, a new bugfix and tooling update for Kotlin 1.2. This release:

  • Updates Kotlin support in the Eclipse IDE plugin
  • Adds new functions in common and JS parts of the standard library
  • Brings JUnit 5 support to kotlin.test
  • Improves experimental scripting support
  • Introduces Runnable Kotlin scratch files in IntelliJ IDEA
  • Speeds up building multimodule Android projects with Gradle
  • Updates experimental @JvmDefault support with a binary compatibility mode
  • Introduces a progressive compiler mode
  • Fixes a lot of known issues in the compiler and the IDE plugin and provides performance improvements

The update is compatible with all versions of IntelliJ IDEA from 2017.2 to 2018.2 EAP, as well as with Android Studio 3.0, 3.1, and 3.2 Canary.

Continue reading

Posted in Releases | Tagged | 22 Comments

Embedding Kotlin Playground

Oh yes, this is a runnable Kotlin snippet embedded right in the blog post.
Note that you can not only run it, but you can also change the code:

Cool, isn’t it? Note that completion works too.

Often you don’t want to show all the code in the snippet, but instead only the most interesting and substantial parts of it. This is possible as well.

You can also add tests:

You can use JavaScript as a target or even draw on a canvas:

Sometimes you don’t need or can’t make a runnable sample. In that case you can apply a highlight-only attribute and get the snippet exactly in the same style, but without the ability to run it.

Embedded Kotlin playground and how it’s done

Historically, thousands of newcomers used try.kotlinlang.org as an interactive way of learning the language. In particular, Kotlin Koans online have been extremely popular. More advanced users use this playground for trying small snippets without opening an IDE, for example before pasting code as an answer on StackOverflow.
Embedded Kotlin Playground works on the same technology, but lets you write and run samples on your webpages. It compiles code on our backend server and then runs either in your browser (if the target platform is JS) or on a server (if the target is set to JVM).


Adding an embedded Kotlin playground is as easy as writing a single line in the page header:

Now all the code blocks on the page will be converted to runnable Kotlin snippets. Of course, data-selector is customizable and you can apply the script only to some particular class. There’s also an option to configure a Kotlin playground manually:

There’re also a lot of different installation and customization options. Read more in the documentation.


The backend part of the playground compiles the code and provides information for completion and highlighting. Generally, you shouldn’t need to bother about the backend and you may stick with our server unless you want to reference custom JVM libraries.

For writing examples that use some external library, for example when you’re creating interactive documentation for your library, you will have to configure and run your instance of the playground backend. It’s very easy to do: you’ll just need to add any dependencies, run two predefined Gradle tasks, then docker-compose up, and voila – the server is running. See these instructions for details.

Where it’s already used

  • We already extensively use this technology for writing Kotlin documentation on the official website. All new bits of documentation are written using runnable samples (see Basic syntax, What’s new in 1.1 and 1.2, Lambdas and Coroutines. For some functions from the standard library, there are live examples as well (see groupBy for example).
  • Kotlin By Example is written with Kotlin-Playground live samples.
  • We’ve also released a plugin for WordPress. It adds a [kotlin] shortcode which allows embedding an interactive Kotlin playground in any post. All the samples on this page are written with the help of this plugin.
  • On the Kotlin forum, you can use the run-kotlin language in markdown syntax to answer questions, with full correctness guaranteed.

Where this can be used

Kotlin Playground improves the reading experience and increases the expressiveness of code examples. It allows readers to not only see the code but also run it, change it, play with it, and run it again. We encourage all authors to use runnable Kotlin snippets, especially when creating:

  • Learning courses
  • Supplementary materials for slides and books
  • Documentation for libraries and frameworks
  • Examples in blog posts

Later we are going to support scripting in Kotlin Playground as well.

Posted in Playground, Releases, Tools | 17 Comments

Kotlin/Native v0.7 released: smoother interop, frozen objects, optimisations and more.

We’re happy to announce the release of Kotlin/Native v0.7, May Day edition! This release provides even smoother interoperability with Objective-C and Swift, memory management improvements, global program analysis and performance optimisations. Also numerous bugfixes and optimizations were implemented in this release.

AppCode and CLion Kotlin/Native plugins were updated to work with v0.7, along with minor performance and usability improvements.

Continue reading

Posted in Native, Releases | Tagged | 9 Comments

Kotlin 1.2.40 is out!

We’re happy to announce the release of Kotlin 1.2.40, a new bugfix and tooling update for Kotlin 1.2! This update:

  • Allows platform modules in experimental multiplatform projects to have more than one expectedBy dependency;
  • Enables support for crossinline suspend parameters in inline functions;
  • @JvmDefault annotation that makes interface methods default in Java (experimental);
  • Adds new inspections and intentions to the Kotlin IntelliJ plugin;
  • Deprecates using short names of types brought into the scope through subtyping of companion objects, without qualifying or importing them;
  • Fixes a lot of known issues in the compiler and the IDE plugin and provides performance improvements.

The update is compatible with all versions of IntelliJ IDEA from 2017.1 until 2018.1, as well as with Android Studio 3.0, 3.1, and 3.2 Canary.

Continue reading

Posted in Releases | Tagged | 21 Comments

Kotlin/Native Plugin for AppCode

Greetings Kotlin fans!

Ever since we announced interoperability with Objective-C for Kotlin/Native, we’ve been getting lots of questions about IDE support that would allow working on projects that mix Kotlin/Native and Swift/Objective-C. Today we are happy to announce that we are working on a Kotlin/Native plugin for AppCode!

AppCode is our macOS-only IDE designed for iOS/macOS developers. It already supports the Xcode project model, running and debugging in simulators and on devices, and offers extensive support for Objective-C and Swift. So, it felt natural to add Kotlin/Native support to the mix.

Continue reading

Posted in iOS, Native, Releases, Tools | Tagged | 13 Comments

KotlinConf 2018 – Call for Papers

If you haven’t heard, KotlinConf 2018 is taking place in Amsterdam, October 3rd-5th!

With just over 2 weeks left for the Call for Papers to close, this is your chance to share your Kotlin knowledge and story with the community at the Kotlin event of the year!

Topics we’d love to hear about

  • Kotlin/Native. Whether you’re targeting iOS, creating native applications for macOS, Windows, Linux, or even targeting embedded.
  • Multiplatform and code sharing.
  • Asynchronous and Concurrent Programming.
  • Frameworks and Libraries in Kotlin.

Of course, these are just some of the topics. We also want to know about

  • Server Side Development
  • Web Development
  • Desktop Development
  • IoT Development
  • Scripting Language
  • Data Science
  • Ops (Build, CI, Monitoring, etc..)
  • Functional/Reactive Programming
  • Kotlin in the Enterprise
  • Mobile Development (Android and iOS)
  • Case Studies

There’s a story in everyone

Remember, you don’t necessarily have to have invented or done something completely new or unique to talk about it. The beauty of sharing what you’re doing is that we each have our own perspective, our own stories. And KotlinConf is as much of a place to learn new things as it is about sharing experiences.

The call for papers closes on the 20th April, so submit today

Posted in community, Events | Comments Off on KotlinConf 2018 – Call for Papers

Kotlin 1.2.30 is out

We’re happy to announce the release of Kotlin 1.2.30, a new bugfix and tooling update for Kotlin 1.2. This update:

  • Adds a new declaration in the standard library, which imitates the suspend modifier for lambda expressions
  • Adds support for TestNG in kotlin.test
  • Brings support for Android modules in multiplatform projects
  • Introduces a new feature in kapt for reporting annotation processing errors along with proper links to the original Kotlin declarations
  • Adds a lot of new inspections and intentions in the IntelliJ plugin and improves its performance
  • Fixes bugs in the compiler and IntelliJ plugin

The update is compatible with all versions of IntelliJ IDEA from 2017.1 until 2017.3 and 2018.1 EAP, as well as with Android Studio 3.0 and Android Studio 3.1 (Beta)

Continue reading

Posted in Releases | Tagged | 17 Comments

Kotlin/Native v0.6 is Here!

We are pleased to announce Kotlin/Native v0.6 (Valentine’s Day release) of our toolchain. This is a major update, including the following features:

  • Support for multiplatform projects in compiler and Gradle plugin
  • Transparent Objective-C/Kotlin container classes interoperability
  • Support first embedded target (STM32 board)
  • Kotlin 1.2.20, Gradle 4.5 and Java 9 supported
  • Smaller WebAssembly binaries (basic applications is around 160KiB now)
  • CLion plugin update for CLion 2018.1 (fixed the issue with macOS platform libraries indexer)

Continue reading

Posted in Native, Releases, Tools | Tagged | 18 Comments

Application development in Kotlin/Native

In this blog post we are discussing development of Kotlin/Native applications. Today we take a look on basic video player, using FFMPEG audio/video decoder and SDL2 for rendering. Hopefully, it will be useful guide for Kotlin/Native development enthusiasts and will explain intended mechanisms of using the platform.

As main focus in our tutorial is on Kotlin/Native, we will give only cursory view on how videoplayer shall be developed. Please see this excellent tutorial, called “How to Write a Video Player in Less Than 1000 Lines” for reference on how it could be done in C language. If you’re interested in comparing how coding in C differs to coding in Kotlin/Native, I would recommend starting with this tutorial.

Continue reading

Posted in Coding, Native | Tagged | 23 Comments

Using Gradle build cache with Kotlin

Eric Wendelin
This is a guest blog post from Eric Wendelin
software engineer for Gradle

A build cache allows Gradle to reuse task output from any previous invocation, including those from other machines. Kotlin 1.2.21 allows Kotlin projects to make use of build caching.

The build cache works by storing compiled classes, test outputs, and other build artifacts in a cache, taking into account all task inputs, including input file contents, relevant classpaths, and task configuration.

Build Cache topological diagram

This frequently results in faster builds. The following chart shows aggregated build time with and without the build cache for part of Gradle’s CI:

Build minutes saved with Gradle build cache

In this post, we’ll explain how you can use Gradle’s build cache to avoid unnecessary Kotlin compilation to speed up your builds.
Continue reading

Posted in guestpost, Tools | Tagged | 13 Comments