Choosing between DexGuard and ProGuard in Android development
Discover the nuances between DexGuard and ProGuard – two powerful libraries that can fortify your app against security threats.
Financial services
Expertise in core banking, BaaS integrations, payments, and GenAI-enhanced financial solutions.
Healthcare
People-centric healthcare design and solutions, from virtual care, integrations, to smart devices.
Insurance
Modern solutions including self-service, on-demand, and algorithm-driven personalization.
We’re purposefully shaping the digital future across a range of industries.
Discover some of our specific industry services.
Discover moreJune 21, 2023
Check out what is new in Kotlin, a widely used programming language for Android.
Kotlin has become one of the most popular programming languages for Android development in recent years. It is now widely used by developers across the globe to create high-quality Android apps. Kotlin offers several advantages, such as better code quality, enhanced performance, and improved developer productivity. Today, we will explore the latest features and updates in Kotlin for Android development, which is utilized by our Mobile Studio.
Also known as the codename “K2”, the Kotlin 2.0 compiler is a drop-in replacement for most code, so the developer using it doesn’t have to change their Kotlin source. The new architecture will be faster and have better build performance, and it is said to be twice as fast as the current Kotlin compiler.
The Kotlin 2.0 compiler is expected to have a stable release in 2024, but it’s currently able to be tried out as soon as possible to verify it works correctly.
You can test it out by the setting the language version to 2.0, as shown below:
// build.gradle.kts (module)
kotlin {
sourceSets.all {
languageSettings {
languageVersion = "2.0"
}
}
}
Android has primarily used Kotlin for years, due to higher productivity and more stable apps for developers. Even with a Kotlin preference, the default language to define builds has been Groovy, even with a Kotlin Gradle option.
Android has recently announced that they will be switching to Kotlin for the default languages for build scripts. This is a beneficial change for Android developers, since there are a lot of benefits to having Kotlin as the default language. Kotlin builds scripts by using statically typed values, so code hinting is more precise and helpful. Syntax errors are also more accurate and displayed while editing Kotlin build scripts instead of when the developer is trying to sync the project. Kotlin DSL also includes type and method documentation. There is also the option to migrate your build to version catalogs, if you’re looking to add and maintain your dependencies and plugins in a scalable way. If you’re looking for resources on how to make the changes, here are some guides from Android Studio:
Code generation initially began with the Kotlin Annotation Processing Tool (KAPT), which generates Java stubs for Kotlin code and allows annotation processors written for Java to work with Kotlin. This stub generation has been a time consuming process, and over has had a significant impact on the build speed of projects that use annotation processing.
However, KSP is a Kotlin-first alternative to KAPT, which analyzes Kotlin code and has shown to have several advantages such as:
Migration is recommended to be done as soon as possible. Here is how to set it up:
// build.gradle.kts (root)
plugins {
id("com.google.devtools.ksp") version "1.8.10-1.0.9" apply false
}
// build.gradle.kts (module)
plugins {
id("com.google.devtools.ksp")
}
dependencies {
kapt("androidx.room:room-compiler:2.5.0")
ksp("androidx.room:room-compiler:2.5.0")
kapt("com.squareup.moshi:moshi-kotlin-codegen:1.14.0")
}
For more information, check out the official libraries for KSP support:
Kotlin Multiplatform is made to simplify the development of cross-platform projects by sharing Kotlin code across different platforms. It reduces the overall time spent writing and maintaining the code for different platforms, while maintaining the benefits of native programming.
Kotlin Multiplatform is currently in Beta, and Google is currently experimenting with code sharing in Kotlin across Android, iOS and web while utilizing Google Suite applications.
With the benefits of native programming while working on different platforms, Kotlin provides the following code sharing mechanics:
Some Jetpack libraries are bringing support for Kotlin Multiplatform, to learn more about the Jetpack libraries, click here.
Kotlin has introduced several new features that will continue to make it a great language for Android development. Kotlin is continuing to make it easier for developers to write clean and efficient code, and making it more efficient to migrate their existing code to Kotlin.
Overall, Kotlin is a powerful language, and as Google continues to support Kotlin and add new features to the language, we can expect even more exciting features in the future. To learn more about what our Mobile Studio is doing in Android development, check out our Mobile Studio site at App Solutions Studio.
Mobile Developer
Receive regular updates about our latest work
Discover the nuances between DexGuard and ProGuard – two powerful libraries that can fortify your app against security threats.
Check out some tips on how to save the UI state during Android development.
What are the differences between Jetpack Compose and XML? Read more to find out!
Receive regular updates about our latest work
Get in touch with our experts to review your idea or product, and discuss options for the best approach
Get in touchProduct Design Solutions
Artificial Intelligence Services
Healthcare Solutions
Data
App Solutions
Platform engineering
Cybersecurity
SRE & Cloud Services
Quality Assurance
Blockchain
Firmware & IoT Development
Product Management
Financial Services Technology
Insurance