Reputation: 3614
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
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