使用 Kotlin 进行 Android 开发
Android mobile development has been Kotlin-first since Google I/O in 2019.
Using Kotlin for Android development, you can benefit from:
- Less code combined with greater readability. Spend less time writing your code and working to understand the code of others.
- Mature language and environment. Since its creation in 2011, Kotlin has developed continuously, not only as a language but as a whole ecosystem with robust tooling. Now it's seamlessly integrated in Android Studio and is actively used by many companies for developing Android applications.
- Kotlin support in Android Jetpack and other libraries. KTX extensions add Kotlin language features, such as coroutines, extension functions, lambdas, and named parameters, to existing Android libraries.
- Interoperability with Java. You can use Kotlin along with the Java programming language in your applications without needing to migrate all your code to Kotlin.
- Support for multiplatform development. You can use Kotlin for developing not only Android but also iOS, backend, and web applications. Enjoy the benefits of sharing the common code among the platforms.
- Code safety. Less code and better readability lead to fewer errors. The Kotlin compiler detects these remaining errors, making the code safe.
- Easy learning. Kotlin is very easy to learn, especially for Java developers.
- Big community. Kotlin has great support and many contributions from the community, which is growing all over the world. According to Google, over 60% of the top 1000 apps on the Play Store use Kotlin.
Many startups and Fortune 500 companies have already developed Android applications using Kotlin – see the list at the Google website for Kotlin developers.
If you want to start using Kotlin for Android development, read Google’s recommendation for getting started with Kotlin on Android.
If you're new to Android and want to learn to create applications with Kotlin, check out this Udacity course.