Kotlin 1.4-M2 Preview Released – Key Features & Major Improvements

Kotlin 1.4 M2

Kotlin claims it makes developers happier. Many Android developers agree. The programming language has increasingly become popular with programmers around the world. If you are one of those enthusiastic Kotlin users, you have more reasons to be cheerful: Kotlin 1.4-M2 is now available. This is likely to enhance your Kotlin app development projects. In this blog post, we will discuss major improvements and key features offered by Kotlin 1.4-M2. Keep scrolling to get all the details about this new release.

Before we dive deeper into all the structural and functional elements of Kotlin 1.4-M2, let’s have a cursory look at the main features big fixes offered by this new release. All these features and updates are aimed at improving Android app development in terms of security and code quality.

Key features and Improvements in Kotlin 1.4-M2
• A hierarchical structure in multi-platform projects to allow sharing code in several targets.
• An improved and more flexible Kotlin Project Wizard for easier creation and configuration of projects.
• A new compiler mode for library authors. Called explicit API mode, it will enable developers to create consistent and well-described APIs.
• Kotlin 1.4-M2 also introduces native support for using suspended functions from Swift and Objective-C.
• Refined Gradle DSL, CSS support, and common export annotation for Kotlin/JavaScript.

Now let’s discuss these features elaborately. A detailed understanding of the new features and improvements will help you to easily deploy the updates. The sooner you use these features for Kotlin app development the better for your project.

Sharing Code in Several Targets
The new hierarchical structure of Kotlin 1.4-M2 enables you to share code with different projects. This is particularly useful in multi-platform projects. The feature made it easy for you to share code between all targets. Before this update, a code added to a multi-platform project could be placed either in a platform-specific source set or in a common source set.

The new hierarchical project structure adapts to the API and language features available in each source. This is done based on the targets that consume them. Please note that the new hierarchical structure and multi-platform projects require Grade 6.0 or later staring with Kotlin 1.4-M2.

Sharing Kotlin Code in Libraries
With the new hierarchical structure, libraries also provide common APIs for a subject of targets. So, when a library is published the API of its shared source is embedded into the library. The information about the project structure also integrates into the library along with the project structure. Hence when you use the library, the shared source sets of the project can easily access the APIs.

Using Native Libs in the Hierarchical Structure
Kotlin 1.4-M2 enables you to use platform-dependent libraries like Foundation, UIKit, and POSIX. You can use these in source sets shared among different native targets. This will enable you to share native code without facing the restrictions of platform-specific dependencies. You don’t have to follow any additional steps since everything is done automatically. Using the IntelliJ IDEA, you can detect the common declarations that you can use in the code.

Limitations in the hierarchical structure:
You should keep in mind the following limitations while using native libs in the hierarchical structure.
• This method only works for a native source set shared with platform-specific source sets.
• The new hierarchical structure works only for interloop libraries shipped with Kotlin/Native.

An Improved, Flexible Project Wizard
The new version of Kotlin offers you a more flexible and comprehensive project wizard. The new Kotlin Project Wizard enables you to create and configure Kotlin app development projects of different kinds from a single platform. These include multi-platform projects that you usually find difficult to configure without using a UI.

In the previous versions of Kotlin, you had to create different projects from different places having configuration options. With a single platform for everything, your work gets easier and more efficient.

Consistent APIs with a well-defined API mode
Kotlin has introduced a new compiler mode to help library authors create consistent APIs for every project. In the “explicit API mode,” the compiler performs additional checks on declaration exposed to the library’s public API. These checks include visibility modifier for declarations if the default visibility exposes them to the public API and the requirement of explicit type specifications.

The improvements and new features offered by Kotlin 1.4-M2 has made the programming language more flexible and comprehensive. Kotlin has asked developers to report bugs if they find any in this preview version. The bugs will be fixed before the final release. At Android Developer, a mobile app development company, we are excited about this new major release. We have been enthusiastically using the programming language for a wide variety of projects. Like mentioned at the very begging of this post, Kotlin has made us happier about Android app development projects.


Q. What is cross-platform mobile app development?
Cross-platform mobile development is the creation of apps that are compatible with multiple mobile operating systems, such as Android and iOS. Developers write the core of the application as an HTML5 or JavaScript mobile app and then make the necessary coding for different platforms.

Q. How much does it cost to build a Kotlin-based Android app?
The costs of developing a Kotlin-based Android app depend on several factors. Design complexity, development time, type of features, etc. play an important role in calculating the costs. We develop feature-rich Kotlin-based apps at a competitive price.

Q. How long does it take to develop an Android app in Kotlin?
There’s no predefined time for developing a Kotlin-based app. It varies widely depending on the features of the app and its design. The best way to know an estimated time is to consult development experts.