I was following the gradle docs to separate source files per test type in a Java project and I wanted to do the same thing in an Android library project. By default Android plugin com.android.library supports two types of test directories test and androidTest. How do I add say integTest which I wanted to run after test?
sourceSets {
integTest {
java.srcDir file('src/integTest/java')
resources.srcDir file('src/integTest/resources')
}
}
When I try to add the above sourceSet to the build.gradle, I get the error
ERROR: The SourceSet 'integTest' is not recognized by the Android Gradle Plugin. Perhaps you misspelled something?
Since Android Gradle Plugin doesn't support custom sourceSets like Java Plugin, is there any other way to solve this problem?
The main reason for the error is defining the
sourceSetforintegTestinsideandroid, just moving it outside solved the issue. See below for correctbuild.gradle