Kiryl Tkach
Kiryl Tkach

Reputation: 3614

androidTest Groovy analog in build.gradle.kts

When testing migrations in Android Room it is needed to add this Groovy code to build.gradle file

android {
...
    sourceSets {
        // Adds exported schema location as test app assets.
        androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
    }
}

I am using Gradle Kotlin DSL, so I have Kotlin instead of Groovy for Gradle files (build.gradle.kts) and I can't find analog of androidTest there (androidTest is not resolved). What is androidTest and what will be analog of this piece of code in Kotlin script?

Upvotes: 9

Views: 1447

Answers (1)

Tadej Zupancic
Tadej Zupancic

Reputation: 351

I've tried the following, which I've found here and it adds the directory.

sourceSets {
    getByName("androidTest").assets.srcDirs("$projectDir/schemas")
}

Upvotes: 19

Related Questions