Android KTX - Kotlin Extensions
Written by Mike James   
Wednesday, 07 February 2018

Google has just announced Android KTX, a library of Kotlin extensions that are designed to make Android easier to program using the latest first class Android Language. It at least reveals how serious Google is about Kotlin for Android.


KTX is a strange beast. It isn't part of the Android Framework and it has to be included as a separate library to make use of it.:

"Today, we are announcing the preview of Android KTX - a set of extensions designed to make writing Kotlin code for Android more concise, idiomatic, and pleasant. Android KTX provides a nice API layer on top of both Android framework and Support Library to make writing your Kotlin code more natural."

It isn't being released as production quality code as yet, but given its nature it seems safe enough to try it out. If an extension isn't doing what you want you can simply drop back to the Framework. The only warning is that, given it is a preview, it could change.

The team is so keen on Kotlin that they have produced a video and called it Introducing Android KTX: Even Sweeter Kotlin Development for Android:



The final "Kotlin is here to stay and we have big plans for it" is quite an eye opener if you are planning to stay with Java.

It is true that most of the extensions are simply syntactic sugar and yes you could dismiss them on these grounds, but they do make programming easier.  Many of the changes could have been made directly to the Framework rather than as extensions but extensions mean you can take it or leave it.

KTX also introduces the androidx namespace:

"This is a new package name prefix that we will be using in future versions of Android Support Library. We hope the division between android.* and androidx.* makes it more obvious which APIs are bundled with the platform, and which are static libraries for app developers that work across different versions of Android."

It also raises the question of how much overhead is involved in using KTX, both in terms of the included libraries and the extensions as static methods.

It is interesting to see how many of the improvements could have been added to Java with a little more effort and Java 8 support.  What is certain is that the Android team seems to love Kotlin and this probably means that Java is going to get less attention in the future.


Mike James is the author of Android Programming In Kotlin: Starting with an App and The Programmer's Guide To Kotlin





More Information

Introducing Android KTX: Even Sweeter Kotlin Development for Android

Related Articles

Android Programming In Kotlin: Layouts and Autonaming Components

The Programmers Guide To Kotlin - Iterators, Sequences & Ranges

Kotlin Begins Its Takeover Of Android

The Future Development Of Kotlin

Kotlin - New Language For Android

Kotlin - another Java alternative?


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.



Flutter 3.13 Improves Impeller

Flutter 3.13 has been released with improvements to Impeller, Flutter's new graphics renderer. The new version also has new Engine APIs for foldable devices.

Bun 1.0 Released With Experimental Windows Version

Bun, the new JavaScript runtime, is now available in a 1.0 production-ready version, according to the developers, who have also announced an experimental Windows version.

More News

Summer SALE Kindle 9.99 Paperback $10 off!!




or email your comment to:


Last Updated ( Wednesday, 07 February 2018 )