what you are doing is absolutely correct, here is an example of one of my projects, which I use as a library:
dependencies { compile project(':boundservice') }
of course, what you have to do is define the module that you added to the library as
android-library plugin, not an application.
This should happen automatically if you do this using the New Module โ Android Library option, but maybe as this project, as I understand it ... has nothing to do with Android, you just have to select the Java Library option.
When you do this and synchronize the build.gradle file (maybe a small clean build should also help), you should be able to use your class files in an Android project.
source share