One solution I found is this: https://stackoverflow.com/questions/38139639/how-to-get-local-jar-dependency-in-gradle
but doesn’t work in newer versions of gradle.
I also found that the solution might be related to configurations.debugCompileOnly.files
or configurations.debugCompileOnly.asFileTree
but again its deprecated.