Since version 3.0.0, the Android Gradle Plugin allows you to export a module's dependencies to other modules.
So in my android library module I should be able to declare a dependency using api <dependency declaration>
and access THAT dependency as an exported transitive dependency in my main app project, where I've declared my library module as a dependency.
I'm also using static file dependencies.
As an example:
I have a class NeededEverywhere
, which is defined in its own gradle module everywhere-module
. This module is in the same project as my library module.
//library module's build.gradle:
dependencies {
api project(':everywhere-module')
}
In my app's build.gradle (which is in a different Android Studio project), I declare my dependency on the library, but not the everywhere-module
. This should mean that everywhere-module
is an exported transitive dependency.
//app project's build.gradle
dependencies {
implementation files("path/to/my/library/file.aar")
}
However, I can't access the class NeededEverywhere
in my app.
What am I doing wrong?