Stanislav Kral
10/14/2022, 9:37 AMA and B
In A I declare a dependency on a local x.aar archive using the api keyword.
Now, A has access to all classes inside x.aar .
In B I declare a dependency on A using the implementation keyword, hoping, that I could access classes from x.aar.
This does not work because B says that x.aar cannot be found.
This can be fixed by adding repositories to `B`:
repositories {
flatDir {
dirs "../libs"
}
}
Is there any way I can do that without explicitly importing the x.aar library in B?
Summary: I'd like to access an imported library (.aar lib) from A in B without having to import the lib in B .
Thanks a lot.
EDIT: sorry, I meant dependency B -> A . Additionally, sorry that this is a general Gradle question.ephemient
10/14/2022, 9:49 AMVampire
10/14/2022, 9:50 AMB to A, not B to B, this is quite normal.
A consumer of a dependency has to provide all repositories that are necessary to resolve the dependency and all transitive dependencies.
If you for example declare a dependency on library X in the Spring Maven repository in A and then depend on A from B without declaring the repository in B too, you also miss that dependency.
Repositories configuration never propagates and that is also important, as for example some company guidelines require that all dependencies come from some internal repository and so on.
I usually only declare the repositories for all projects in the settings script and even disallow declaring additional repositories in projects, that way all projects share the same repository declarations.Stanislav Kral
10/14/2022, 10:33 AM