android - How to enable viewBinging in android project using Kotlin gradle dsl?
问题描述
android { ...I'm trying to enalbe ViewBinding in my project witch use Kotlin Gradle DSL. All examples show how to do it with Groovy DSL.
android {
...
viewBinding {
enabled = true
}
}
But this solution isn't works with Kotlin DSL. I was trying solution like this:
android {
...
viewBinding.enabled = true
}
But it also doesn't work. It's interesting, that this approach works for DataBinding.
解决方案
只是做同样事情的一种更新方式,因为isEnabled已被弃用。
只需添加此块
viewBinding {
android.buildFeatures.viewBinding = true
}
推荐阅读
- node.js - 在基于 Angular 6 的项目中更新 npm 时出错
- airflow - 重命名任务后 Airflow dag 卡住了
- java - 需要帮助了解遍历二叉搜索树方法
- reactjs - 如何将自定义 Avatar 组件添加到 Input 组件中以上传图像
- c# - 为什么 .Clear() 函数清除了错误的列表?
- java - 需要重定向或包含在 Spring MVC 控制器中的解决方案
- eclipse-cdt - CDT可以递归地添加来自子目录的包含路径吗
- excel - 如果它包含 Excel 中的填充单元格,则计算列
- mysql - 计算用户使用的数据量(字节)
- sunburst-diagram - 如何使用 R 在旭日形图中自定义戒指尺寸?