BuildSrc dependency in library module


(Pavlos-Petros Tournaris) #1

Hey all, new to the forum and I wanted to ask the following, for which I did not find any answer while Googling.

I have a buildSrc folder containing some Kotlin files which I can access through main applications module :app in order to use them in dependencies. Main module’s build.gradle file is still in Groovy.

Now what I am trying to do is to convert let’s say moduleA's build.gradle file into Kotlin DSL, on which I am applying the com.android.library plugin as well as the android plugin from Kotlin.

For some reason though, I can not access methods defined in root build.gradle file, neither the Kotlin files containing the dependencies, located in buildSrc.

Is there anything that I might be missing? When hovering on the red highlighted dependency it asks to add a dependency on buildSrc module, which feels pretty weird.

Edit #1: One more thing to not here is that, buildSrc is located in top level like app module, while the modules that can not access it are located in a level below under modules folder. So we have:

buildSrc
app
modules
| moduleA
| moduleB

I am pretty sure this must have been the issue, but not sure if it is resolvable somehow.
Thank you in advance