Android dependency is set to compileOnly/provided which is not supported

At the dawn of "Dynamic feature modules", compileOnly Android library modules could make sense, to allow easy access to the feature module from the base app when it is installed.

That's why I created this feature request: https://issuetracker.google.com/issues/109894265

Feel free to star it and comment with your use cases.


As an experiment, I created a new Android Studio 3.1.1 project. Then, I added a lib module to it as a plain Java library module. I could add compileOnly project(":lib") to the app module, and it compiled. I changed the lib module to be an Android library module (apply plugin: 'com.android.library') with a minimum manifest, and now compileOnly project(":lib") gets the error that you do: "Android dependency 'project :lib' is set to compileOnly/provided which is not supported".

Since there were no other material changes in the lib module, the compileOnly limitation is on Android library modules.

My guess is that it is unclear what "compile only" means for manifest entries, resources, assets, etc. So, they officially punted.

I filed an issue, requesting documentation of this limitation. My requests for documentation usually fall on deaf ears.

Tags:

Android

Gradle