本文介绍了如何通过Kotlin Android扩展插件禁用合成视图属性的生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

文档.

我想禁用此功能,因为我们使用DataBinding而不是Kotlin合成视图属性,有时我会无意中导入它们;还会为我们不使用的东西增加额外的构建开销.

I would like to disable this feature, because we use DataBinding instead of the Kotlin synthetic view properties, and sometimes I import them by accident; also it adds extra build overhead for something we don't use.

无法禁用Android扩展插件,因为我们使用了由同一插件完成的Parcelize功能.

Disabling the Android extensions plugin is not possible, because we use the Parcelize feature which is done by the same plugin.

推荐答案

androidExtensions DSL中有一个features属性,可让您提供要启用的功能列表.当前,只有两个可用,parcelizeviews.要禁用综合视图属性,请将其添加到您的build.gradle:

There is a features property in the androidExtensions DSL that allows you to provide a list of features to enable. Currently, there is only two available, parcelize and views. To disable synthetic view properties, add this to your build.gradle:

androidExtensions {
    features = ["parcelize"]
}

来源: https://github.com/JetBrains/kotlin/blob/6bef27e1e889b17ae84dd2ff99881727f13ac3e5/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/合成/AndroidComponentRegistrar.kt#L57

这篇关于如何通过Kotlin Android扩展插件禁用合成视图属性的生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 15:49