解决DSL element ‘android.viewBinding.enabled‘ is obsolete and has been replaced with ‘android.buildFea

DSL element 'android.viewBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.viewBinding'.
It will be removed in version 5.0 of the Android Gradle plugin.
Affected Modules: app

我的Android studio版本如下: Bumblebee | 2021.1.1 Patch 2

实际上就是换一种写法。错误信息也给了解决办法。

原来这样:

    android {
        dataBinding {
            enabled = true
        }
        viewBinding {
            enabled = true
        }
    }


现在是:

    android {
        buildFeatures{
            dataBinding = true
            viewBinding = true
        }
    }

参考文档 是“DSL element 'android.viewBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.viewBinding'.” Code Answer’s

猜你喜欢

转载自blog.csdn.net/qq_33721320/article/details/123813261