将 Lyft 的 Android 代码库迁移到 Kotlin

Sitemap

Sitemap

[

[

Lyft Engineering

Lyft Engineering

](https://eng.lyft.com/?source=post_page---publication_nav-25cd379abb8-53b231dfecb5---------------------------------------)

](https://eng.lyft.com/?source=post_page---publication_nav-25cd379abb8-53b231dfecb5---------------------------------------)

[

[

Lyft Engineering

](https://eng.lyft.com/?source=post_page---post_publication_sidebar-25cd379abb8-53b231dfecb5---------------------------------------)

](https://eng.lyft.com/?source=post_page---post_publication_sidebar-25cd379abb8-53b231dfecb5---------------------------------------)

Stories from Lyft Engineering.

Lyft Engineering 的故事。

Featured

精选

Introduction

引言

Lyft started adopting Kotlin into our Android codebase in 2018. Fast forward 7 years, and we are finally done! Lyft Rider, Driver and Lyft Urban Solutions apps are now fully Kotlin-based.

Lyft 在 2018 年开始将 Kotlin 引入我们的 Android 代码库。快进 7 年,我们终于完成了!Lyft Rider、Driver 和 Lyft Urban Solutions 应用现在完全基于 Kotlin。

I joined Lyft in 2022, so this post will describe the efforts undertaken after that.

我在 2022 年加入 Lyft,因此这篇文章将描述在那之后的努力。

Our motivation included several points:

我们的动机包括几个方面:

  • Kotlin code is more concise, and oftentimes, way more concise than Java. In some cases, 10 lines of Java could be turned into a 1-liner in Kotlin.
  • Kotlin 代码更简洁,通常比 Java 简洁得多。在某些情况下,10 行 Java 可以转换为 Kotlin 中的一行。
  • We get compile speed benefits by using the newest K2 compiler.
  • 我们通过使用最新的 K2 compiler 获得了编译速度优势。
  • All the new UIs in Lyft are written using Compose — the modern declarative UI framework approach which is the industry standard. All the existing UIs will eventually be migrated to Compose. That also means Kotlin was the only option, as Compose only supports Kotlin.
  • Lyft 中的所有新 UI 都是使用 Compose ——现代声明式 UI 框架方法,是行业标准。所有现有的 UI 最终将迁移到 Compose。这也意味着 Kotlin 是唯一选择,因为 Compose 仅支持 Kotlin。
  • We started adopting Coroutines — the structured concurrency framework which greatly simplifies writing asynchronous code. Coroutines are part of the Kotlin standard library, so that was an extra argument to adopt Kotlin faster.
  • We started a...
开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.0. UTC+08:00, 2026-03-25 08:48
浙ICP备14020137号-1 $访客地图$