6

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:

https://issuetracker.google.com/issues/78097961

Matt Carron
  • 183
  • 3
  • 11
  • 1
    I noticed at the top of a stacktrace (https://scans.gradle.com/s/c7yagwqy45hfs/failure?openFailures=WzBd&openStackTraces=WzEse31d#top=0) is "com.intellij.core.JavaCoreProjectEnvironment" and it made me wonder if the behavior is better if you run `gradle app:lint` via the command-line... – Eric Wendelin Apr 16 '18 at 16:56
  • Hi @EricWendelin the result is the same with running `app:lint` https://scans.gradle.com/s/k6rvicrjzqepg/ – Matt Carron Apr 17 '18 at 08:08

0 Answers0