Click here to see the Kotlin netease cloud music movement | Android developer stories related to video.

“Music is a beautiful communion of souls, a work of art with emotions. What netease Cloud Music will do is to help users discover and share good music, connect users and musicians with music, let users feel the emotions that musicians want to express, and let more people use music to warm up, shine and gain power.”

— Guo Yuan, product manager of netease Cloud Music

Netease Cloud Music is a music product of netease that focuses on discovery and sharing. Relying on professional musicians, DJS, friends’ recommendation and community functions, it creates a brand new music life for users. At present, the number of users of netease Cloud music has exceeded 800 million, the number of music libraries has exceeded 40 million (recently updated data), and the number of original musicians has exceeded 200,000. It is the most active music community and the largest original music platform in China.

▽ Share music with friends through netease Cloud Music

After the Android client development team introduced Kotlin in August 2019, it quickly became clear that learning Kotlin was a breeze: In the early days, it was common to see discussions about Kotlin’s features in team members’ weekly reports, and from time to time, colleagues would write summaries of Kotlin’s learning and share them. Basically, everybody can get started very quickly. The Kotlin website, the Documentation in the Kotlin project on Github, and the ability to decomcompile Kotlin code into Java code provided by Android Studio help team members gain a deeper understanding of the Kotlin language.

“Kotlin is a new language and technology for Android development, integrating many advanced design ideas from other languages. Compatibility and intercalling with Java code also greatly reduced the resistance we had internally to promoting Kotlin.”

— Jia Bin, senior Android development engineer of netease Cloud Music

Currently, Kotlin files account for about 23% of netease Cloud Music’s Android project, and most of the new features are written using Kotlin. The team also introduced libraries such as KTX and coroutines to improve development efficiency and allow engineers to focus more on the implementation of features themselves.

The first intuitive benefit of using Kotlin is simplicity. The team has done its own statistics:

“Kotlin averaged 82 lines of code per file, a 40% reduction in code volume, compared to 138 lines per file in Java, making Kotlin much cleaner and more efficient.”

— Zhan Zhiquan, Senior Android development engineer of netease Cloud Music, and Kotlin evangelist of netease Cloud Music

Kotlin coroutines provide very convenient thread switching and make it very easy to trace and cancel asynchronous tasks by introducing a structured concurrency mechanism. Coroutines can also be used in conjunction with viewModels. With viewModelScope, you can keep asynchronous tasks and ViewModel lifecycles consistent, helping prevent leaks.

The popular Kotlin coroutine

Almost all of the NPES the team counted for online crashes occurred in Java code, and very few in Kotlin code.

More concise, more efficient, more stable, more relaxed, this is netease Cloud music Kotlin movement. Users find surprises on the music platform, and developers continue to explore new directions, driven by new technology.

How much of your work uses Kotlin? Feel free to share in the comments section below.