HOT DEALS

Google introduces Android KTX, designed to make writing Kotlin code for developers

Android KTX

Have you not upgraded your website to HTTPS yet? Upgrade NOW.

Google with its Chrome 68 update to show all HTTP websites as NOT SECURE. Avoid Google's penalty by installing an SSL Certificate. Get a DigiCert Standard SSL and secure your website at just $157/year. BUY NOW

ADVERTISEMENT

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 both Android Frameworks and Support library so as 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.

Related:

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 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.

Google introduces Android KTX, designed to make writing Kotlin code for developers