I'm trying to add a source set to the "com.android...
# community-support
e
I'm trying to add a source set to the "com.android.compose.screenshot" plugin. When I ran
./gradlew :module:sourceSets
, the screenshotTest is shown on the list, but when I try to use it on the gradle script, I get "SourceSet with name 'screenshotTest' not found. Is this the correct way to add a different directory?
Copy code
android {
    experimentalProperties["android.experimental.enableScreenshotTest"] = true
    sourceSets {
        named("screenshotTest") {

        }
    }
}
v
That most probably means, that the source set is registered after you try to retrieve it with
named("...")
, as
named("...")
requires that the element in question is already registered at the time you are calling that. How to properly do it most probably depends on way more context. Besides that Android is always "a bit special". 😄
p
I believe AGP doesn't allow to add sourceSets