When converting Android Gradle files from Groovy to Kotlin, one thing that may not be clear is how to keep Kotlin sources within src/main/kotlin. We simply need to get the source sets by name and call java.srcDirs() as a function call. Works like a dream! 🛠

sourceSets {
    getByName("main").java.srcDirs("src/main/kotlin")
    getByName("test").java.srcDirs("src/test/kotlin")
    getByName("androidTest").java.srcDirs("src/androidTest/kotlin")
}

Thanks for reading and happy coding! 🙏