When I was trying to use the Catalog feature in Gradle 7.0 https://docs.gradle.org/7.0.2/userguide/platforms.html#sub:central-declaration-of-dependencies
as below into setting.gradle
dependencyResolutionManagement {
// Some other codes
versionCatalogs {
libs {
alias('androidx-core').to('androidx.core:core-ktx:1.6.0')
alias('androidx-appcompat').to('androidx.appcompat:appcompat:1.3.1')
alias('androidx-constrainlayout').to('androidx.constraintlayout:constraintlayout:2.1.0')
alias('android-material').to('com.google.android.material:material:1.4.0')
}
}
}
When I perform gradle sync, it errors out stating
Caused by: org.gradle.api.InvalidUserCodeException: Using dependency catalogs requires the activation of the matching feature preview.
I check https://docs.gradle.org/7.0.2/userguide/platforms.html#sub:central-declaration-of-dependencies, and found it states
Central declaration of dependencies is an incubating feature. It requires the activation of the VERSION_CATALOGS feature preview.
And in https://docs.gradle.org/7.0.2/userguide/feature_lifecycle.html#feature_preview it states
The feature preview API allows certain incubating features to be activated by adding enableFeaturePreview('FEATURE') in your settings file. Individual preview features will be announced in release notes.
I tried adding enableFeaturePreview('FEATURE') in settings.gradle, but don't seems to work. Where should I place enableFeaturePreview('FEATURE')?