Can a Java project depend on an Android AAR or APK?

I’m converting a system of about 30 projects that are in Eclipse to Gradle. One issue I have been stuck on for a couple of days is referencing class files in android apps or libraries from a Java project. In Eclipse this all worked because when you added a dependency to another project, the directory of that project’s class files is added to the class path of the project with the new dependency.

In Gradle it appears that dependencies are only to Jar files as opposed to directories of class files. I’ve been wrestling with trying to add tasks to my Android projects which will create new jars (made up of only the intermediate class files) but this just isn’t working in all circumstances. Given the amount of effort I’ve put into trying to do this it makes me think I’m doing something incorrectly or making a bad assumption.

Any suggestions on how to make this all work?

Is there a straightforward way for a Java project to depend on an Android app or lib?
If not is there a better way of gathering up the class files of those Android projects so my Java project can refer to them?

Thanks, Derek