After i added the buildFeatures { viewBinding = true } setting in my build.gradle file, i got this error:
Gradle sync failed: Could not find method buildFeatures() for arguments [build_7orzo6phc1edx9en9cbbvrw3q$_run_closure1$_closure3@23aed4b2] on object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
I have recently updated my studio to version 4, but the error seems to persist.
Any idea how i can fix this?
I don't know why but the official documentation is wrong It seems that this
buildFeatures {
viewBinding true
}
Is replaced with
viewBinding {
enabled true
}
For build.gradle.kts
android {
buildFeatures.dataBinding = true
buildFeatures.viewBinding = true
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.