Publish to MavenCentral with private submodule

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 ?

I have no idea about Android and this seems more like an Android Gradle Plugin question than an actual Gradle question.

But generally, why should you upload a library to MavenCentral that noone can use, besides your internal users? MavenCentral is a service to publish your library for others to use them. But if you depend on a private dependency that you will not expose, what sense does it make then to actually publish it to MavenCentral?
I mean to remember that there even was a rule or at least strong recommendation that all dependencies of MavenCentral uploaded libs should also be available on MavenCentral and not only somewhere else or not at all.