The way forward for Kotlin Android Extensions

Posted by David Winer, Product Supervisor

The Android Kotlin Extensions Gradle plugin (to not be confused with Android KTX) was launched in 2017 and introduced two new conveniences to Android growth in Kotlin:

  • Synthetics allow you to substitute calls to findViewById with kotlinx.android.artificial bindings.
  • Parcelize lets you take away boilerplate and simply create Parcelables by means of the @Parcelize annotation.

Since then, we’ve got launched View Binding for Android, an formally supported library that has deep integration with the Android construct toolchain and gives comparable performance as Kotlin synthetics. Whereas we proceed to advocate Parcelize, quite a lot of drawbacks have appeared with utilizing Kotlin synthetics:

  • They pollute the worldwide namespace
  • They don’t expose nullability data
  • They solely work in Kotlin code

JetBrains initially developed the Android Kotlin Extensions plugin, and collectively we’ve got mentioned the professionals and cons of constant to keep up synthetics: we attempt to make sure long run help for APIs the place we are able to however need to information builders in the direction of finest practices that make for wholesome codebases and, finally, completely happy customers.

Over the course of the subsequent yr, our groups will probably be collectively deprecating synthetics in favor of constant to help our advisable possibility, View Binding. Right here’s what meaning:

  • If you’re utilizing Parcelize, you’ll be able to proceed to make use of the identical annotations and APIs. The annotation package deal will change to kotlinx.parcelize, nonetheless, and In your module-level Gradle file, you must begin utilizing the standalone kotlin-parcelize plugin as an alternative of android-kotlin-extensions. You’ll have the ability to discover documentation for Parcelize on the Android developer documentation site.
  • If you’re utilizing Android Kotlin synthetics, you must migrate to View Binding. Take a look at our migration guide for extra particulars.

The deprecation interval begins with Kotlin 1.4.20, launched immediately. android-kotlin-extensions will probably be eliminated in a future Kotlin launch throughout or after September 2021. Long run, we are going to proceed to keep up the kotlin-parcelize plugin, and you may proceed to file points on Parcelize within the Android Studio issue tracker.

Recent Articles

We investigated whether or not digital contact tracing really labored within the US

Within the spring of 2020, the primary variations of covid-19 publicity notification techniques have been launched to the general public. These techniques promised...

Samsung Galaxy A72 Evaluate: Definitely worth the Premium Over the Galaxy A52?

The Samsung Galaxy A52 and Galaxy A72 duo have been out there for just a few months. We have already examined the Galaxy A52,...

What are Google Workspace, Areas, and good canvas? This is an explainer

Supply: Nick Sutrich / Android Central Google Workspace is the reply to the query that Google customers have had for years: why cannot this firm...

The iPhone’s High Apps Are Practically 4x Bigger Than 5 Years In the past

Every year throughout Apple’s Worldwide Developer Convention, the corporate declares new iOS updates and its newest applied sciences. Though these...

FedEx groups up with Nuro to check self-driving supply automobiles | Engadget

FedEx is increasing its robotics testing to incorporate one of many greater names in autonomous supply. The corporate has struck a multi-year take care...

Related Stories

Stay on op - Ge the daily news in your inbox