Our Android project is a monorepo containing couple of app modules, and even more library modules. One of the libraries should be also accessible to other developers so we have decided to deploy it on MavenCentral. Let’s call it the library L
. This library however also contains dependency within the monorepo to another module (let’s call it a module m
). In order to test whether the library L
is correctly accessed by the other developers, we have created a demo Android project. But when trying to include the dependency of the publish library L
, generally all works great except that the module m
could not be resolved in the demo Android project.
Understandingly, the module m
could not be resolved due to it being available neither on MavenCentral nor as an AAR file. We cannot publish the module m
on MavenCentral since it should not be available for others to get, but including it as an AAR file, doesn’t work either. Terminal throws an error:
Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error).
So the question comes - how can a project - that includes a submodule that can’t be exposed, be published to repository like mavenCentral
?