Missing Dependency In Dependent Project
I have an android project with following structure: -- Calendar ------app (app module) ----------build.gradle (module level) ------build.gradle (project level) ------Commons(A comm
Solution 1:
There are two things at play here:
- The separation of
api
andimplementation
when declaring dependencies. In short dependencies in theimplementation
scope are only visible at runtime because they are an implementation detail. Such libraries will use theruntime
scope in their published Maven metadata. More information in the documentation - Before Gradle 5.0, the Maven metadata scopes
compile
andruntime
were mixed by Gradle and thus allruntime
dependencies did appear on the compile classpath. Gradle 5 changes this
So when you publish your component, the limitation of Gradle 4.x means that your common
dependencies are available to app
. Note that moving to Gradle 5 will cause a breakage there, as documented.
And when you use the project directly, the separation is properly enforced.
The fix is to simply promote dependencies that are part of the common api to the api
configuration in common
and for the runtime ones, declare them in app
as after all they are directly required by it.
Post a Comment for "Missing Dependency In Dependent Project"