[英]Do I need to add kapt “com.android.databinding:compiler:$compiler_version” gradle entry?
Theofficial documentation never mentions adding a dependency for data binding and neither does the sunflower app (which implements best practices) use it. 官方文档从未提及为数据绑定添加依赖项, 向日葵应用程序(实现最佳实践)也没有使用它。
However, everywhere else I look (also here ) I see people mentioning to add the following (but never really explaining):但是,在我看到的其他任何地方(也在此处),我看到人们提到要添加以下内容(但从未真正解释过):
dependencies {
...
kapt "com.android.databinding:compiler:$compiler_version"
}
I found this and my understanding is that the line above will help to reduce the apk size of the app.我发现了这一点,我的理解是上面的行将有助于减少应用程序的 apk 大小。 Is that really the case?真的是这样吗? Are there other benefits or should I just ignore this as the official docs and resources have?是否有其他好处,或者我应该像官方文档和资源一样忽略这一点?
That dependency is automatically added by enabling data binding.通过启用数据绑定会自动添加该依赖项。 I think there were some Kotlin-related problems a few years ago (your linked-to resources are from 2017 and 2018), but they are fixed now.我认为几年前存在一些与 Kotlin 相关的问题(您链接到的资源来自 2017 年和 2018 年),但现在已经修复。 You do not need to add it manually.您不需要手动添加它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.