Search code examples
androidbuild.gradlegradle-kotlin-dsl

How to add module using org.gradle.api.Project.projects


On my current Android Project, I have a few modules that can depend on each other. e.g: :feature:register can depend on :core:data through the build.gradle.kts with the syntax: implementation(project(":code:data"))

However, I've seen on projects like NowInAndroid that the modules are being accessed using the org.gradle.api.Project.projects, so the syntax looks like: implementation(projects.code.data)

On my project when I use such syntax the projects is not not recognized. How can I use it?


Solution

  • it looks like i figured it out. According to this answer you need to add the line below to your settings.gradle.kts file:

    enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")