Disclaimer: We may earn a commission if you make any purchase by clicking our links. Please see our detailed guide here.

Follow us on:

Google News
Whatsapp

Google Introduces Android KTX, Designed to Make Writing Kotlin Code for Developers

Moupiya Dutta
Moupiya Dutta
She finds it interesting to learn and analyze society. she keeps herself updated, emphasizing technology, social media, and science. She loves to pen down her thoughts, interested in music, art, and exploration around the globe.

Google has announced the preview of Android KTX. It is a set of extensions designed to make writing Kotlin code for Android more concise, pleasant, and idiomatic. The company promises to provide a nice API layer on top of Android Frameworks and the Support library to make writing the Kotlin code more natural.

Google announced that Android officially supports the Kotlin programming language, in addition to Java and C++ at its I/O 2017 developer conference in May. Android studio 3.0 with Kotlin support was also followed in May. Presently it promises an API layer on top of the Android framework and support library. The former is available on GitHub. Google also promises to make the other parts of Android KTX that cover the Android Support Library will be available in upcoming Support Library releases.

The following should be added to the app module’s build.gradle file for using the Android KTX in an Android Kotlin projects:

  • repositories {
    Google()
    }
    dependencies {
    // Android KTX for framework API
    implementation ‘androidx.core:core-ktx:0.1’

    }

After the project gets synced, the extensions will appear automatically in the IDE’s autocomplete list, and to add them to the necessary import statement to the file, we need to choose any of them.

Google alerts that the APIs are likely to change during the preview period. It warns the developers to not use it in their main Android projects as there are chances of changes before the stable version arrives. Google confirms that the preview launch is just the beginning. As soon as the API stabilizes and Google commits to API compatibility, KTX will be released as a part of the Android Support Library.

It is also brought to notice that Android KTX uses package names that begin with androidx. This is the new package name prefix that will be used in future versions of Android Support Library.

The difference between android. and androidx. is that which APIs are bundled with the platform and which are static libraries for app developers for different versions of Android.

The Latest

Partner With Us

Digital advertising offers a way for your business to reach out and make much-needed connections with your audience in a meaningful way. Advertising on Techgenyz will help you build brand awareness, increase website traffic, generate qualified leads, and grow your business.

Recommended