I have a project split up into many modules. One module called ':testcore' contains some common classes used by tests.
The project is in this structure:
:app
:libraryone
:testcore
:librarytwo
:testcore
...
To make these files useable for the other modules I added them one by one to the other module's test sourceSets.
sourceSets {
test {
java.srcDirs += RELATIVE_PATH_TO_TESTCORE_JAVA_FILE
}
}
This is working up until Android Studio 3.0.1 with Gradle 4.1 However with Android Studio 3.1.0 and Gradle 4.4 this now causes an error:
Lint infrastructure error Caused by: java.lang.reflect.InvocationTargetException
Caused by
Caused by: java.lang.IllegalArgumentException: trying to add non-existing file to classpath: ....java
This error seems to be caused by the Android Gradle plugin 3.1.1 and not gradle 4.4 as if I use Gradle 4.4 and Android Gradle plugin 3.0.0 it returns to a successful build.
-------------------
To aid in diagnosing this I created a new test project with a Android app module and a single library module and recreated the build error shown above.
Here is the gradle scan of the build:
https://scans.gradle.com/s/c7yagwqy45hfs
I also added a bug report on the Google issue tracker: