Johann
Johann

Reputation: 29885

Why do Kotlin-specific dependencies exist for Android

I notice that Android often offers two different dependency libraries that provide the same functionality. For example:

implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'

But if I'm developing an Android app using Kotlin, it expects me to use the Kotlin dependency. Why is this? What's special about the Kotlin library?

Upvotes: 2

Views: 109

Answers (1)

a_local_nobody
a_local_nobody

Reputation: 8221

You ask:

What's special about the Kotlin library?

Well,

Android KTX is a set of Kotlin extensions that are included with Android Jetpack and other Android libraries

more info here

These extension methods and other useful functionality usually just makes other tedious tasks a bit simpler OR it makes it a bit more concise by using Kotlin capabilities to achieve something, consider them additional utility methods which help you to write a bit more concise Kotlin code, but you don't have to use this specifically, no

Upvotes: 5

Related Questions