I understand that making a plain Java library that depends on Android one is not usually a good thing and actually does not make sense.
But what if I want to add some annotation processor to my Android library?
As far as I understand these processors should be packed in a separate jar that can be added to a provided configuration in an app project.
I suppose if I organized processors project as an Android library and packed it in aar, it still could be linked in 'provided' configuration and processors would be discoverable for javac.
But I believe you will agree that annotation processor tests should be run on the host system, and I won't be feeling very comfortable while developing processors as an android lib.
Thus my current choice is to have a plain Java project for annotation processor which depends on an Android library (actually on its dedicated configuration producing a jar).
This gives me a way to write code and run tests rather comfortably.
So my Android library has a configuration 'plain' and there is a declared artifact with classes jar for this configuration.
Java project depends on it:
compile project(path: ':android-lib', configuration: 'plain')
But there is a sample Android app which currently cannot do
provided project(':java-project-with-annotation-processors')
because I'm getting
"My Java Project" depends on libraries but is not a library itself
at BasePlugin.addDependency(BasePlugin.groovy:2073)
Any thoughts appreciated. Thanks.