Android Compose 生产就绪了吗?

Is Android Compose Production Ready?

Android Compose 有很多炒作,因为它是声明式的。唯一的问题是它仍然缺少很多功能。 ConstraintLayout 是迄今为止用于增强应用程序性能的最佳布局,Android Compose 仍然没有 ConstraintLayout。对于是否使用AndroidCompose,没有多少文章做过相关论证。在我看来,Android Compose 仍有很多发展空间,尤其是它还没有被很好地记录下来。如果没有一个性能良好的应用程序的所有必需品,Android Compose Production 就绪了吗?

更新:2021 年 8 月,稳定的 1.0.0 版 Jetpack Compose 发布。通过大多数常规措施,Compose 已准备就绪。原始答案以其原始形式显示在下面。


Is Android Compose Production Ready?

我假设“Android Compose”是指“Jetpack Compose”。

2019 年,Google 一直称 Jetpack Compose 处于预览状态,不适合生产使用。

例如,在 the main Jetpack Compose page,我们有:

Note: Jetpack Compose is currently in Developer Preview. The API surface is not yet finalized, and changes are planned and expected.

main Jetpack Compose Tutorial page 上,我们有:

Note: Jetpack Compose is currently in Developer Preview. The API surface is not yet finalized, and should not be used in production apps.

the Android Developer Summit keynote blog post中,我们有:

Today we are releasing the Jetpack Compose Developer Preview. All you need to do is download the latest Preview build of Android Studio. Compose is being developed completely in the open, in AOSP. The continuous feedback we receive has led to many API improvements and we want to thank you for providing feedback in our developer studies and the Kotlinlang Slack group. As we enter developer preview, we need even more feedback as we work towards bringing Jetpack Compose to beta next year and ready for use in production apps.

(强调)

所以,一年后再来看看,我们将看看 Jetpack Compose 是否已经进步到足以让 Google 说你应该在生产应用程序中使用它。

Jetpack Compose 目前处于开发者预览模式。因此,它现在还没有准备好生产。但是他们提供了开发者版本来解决它。

这是实现,您可以在其中试用。

val composeVersion = "0.1.0-dev02"
    implementation("androidx.ui:ui-framework:$composeVersion")
    implementation("androidx.ui:ui-layout:$composeVersion")
    implementation("androidx.ui:ui-material:$composeVersion")
    implementation("androidx.ui:ui-tooling:$composeVersion")

此外,您可以查看文档Here

Jetpack Compose 测试版已发布:https://android-developers.googleblog.com/2021/02/announcing-jetpack-compose-beta.html

With this beta release, Compose is API complete and has all the features you need to build production-ready apps. Beta also means API stable, so we won’t change or remove APIs. Now is a great time to start learning Compose and begin planning for how you will use it in an upcoming project or feature once it reaches 1.0 later this year.

是的,Jetpack Compose 现已投入生产,版本 1 已于 2021 年 7 月 28 日发布: https://android-developers.googleblog.com/2021/07/jetpack-compose-announcement.html