android - Android 扩展中的实验性功能有利于生产版本

标签 android kotlin kotlin-android-extensions kotlin-extension gradle-experimental

我在使用 Kotlin 语言的 Android 开发中使用 @Parcelize 功能。

为了使用它们,我在 build.gradle 文件中做了以下修改。

apply plugin: 'kotlin-android-extensions'

然后

androidExtensions {
    experimental = true
}

我成功使用了上述功能。但是建议将它们用于生产发布还是仅用于开发目的?

最佳答案

但这不仅仅是 Android 的东西,它是一般的 Kotlin。 Kotlin 具有相当多的实验性功能,例如协程和 android 扩展。

如果您阅读 docs ,你会发现这个:

Experimental features, such as coroutines in Kotlin 1.1, have exemption from the compatibility modes listed above. Such features require an opt-in to use without compiler warning. Experimental features are at least backwards compatible for patch version updates, but we do not guarantee any compatibility for minor version updates (migration aids will be provided where possible).

实验性功能仅意味着不同的兼容性系统。它们仍然有效(测试版属于 EAP,EAP 不保证兼容性或稳定性)。实验性功能是技术上的发布,这意味着它们与任何其他语言功能一样稳定(因为可能存在错误,总是存在错误,但它旨在保持稳定)。

所以如果你想在生产中使用它,那就去做吧。实验特性有不同的兼容模式,但它们应该像任何其他语言特性一样稳定。它们在生产中使用是“安全的”,没有太大问题。如果存在不兼容的更新,您可能不得不重新编写代码,但这是开发问题而不是发布问题。

然而,android extensions docs还提到了实验部分:

Android Extensions plugin includes several experimental features such as LayoutContainer support and a Parcelable implementation generator. These features are not considered production ready yet, so you need to turn on the experimental mode [...]

考虑到我之前提到的事情,这可能意味着功能本身还没有完成,相当于协程。您可以在生产版本中使用它,但它不被视为 Kotlin 语言的生产就绪组件。由于它是实验性的,因此已经发布。版本通常比 EAP 版本更好。

另见 this forum post在 Kotlin 论坛上(它提到协程,但其中一些也适用于其他实验性功能)。


而且,很明显,如果它在开发中不起作用,它很可能也不会在生产中起作用。如果扩展中的某些内容完全损坏,请不要使用该特定功能。但这并不一定意味着整个扩展都被破坏了。通常,即使使用 EAP,如果它有效,您也可以在生产中使用它。

关于android - Android 扩展中的实验性功能有利于生产版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50855771/

相关文章:

android - Play控制台显示两个不同版本的每日安装量

android - 如何在 for 循环中使用 drawRect 方法?

lambda - 试图了解Kotlin示例

java - 如何更改 Kotlin 中 RecyclerView 中每个 Even 值元素的颜色?

android - Kotlin中带有对象的列表的深拷贝

android - 如何在 Android 中使用 Kotlin 从 NavigationView 的 headerLayout 中指定的布局访问 View

java - 使用 PGS4A 构建失败。无效的构建文件错误

android - 向上滑动时向上滑动 RecyclerView,或向下滑动时向下滑动 RecyclerView

arrays - 如何比较 Kotlin 中的两个数组?

android - classes.jar' 已经包含条目 'META-INF/module_name_debug.kotlin_module' ,无法覆盖