I'd like to set up Kotlin in an existing Java Andr...
# getting-started
l
I'd like to set up Kotlin in an existing Java Android (library) project but for now I would like to only set it up for unit tests. Is there a way to achieve this?
c
Maybe something like
Copy code
android.sourceSets.configureEach {
    if (!name.startsWith("test")) {
        kotlin.srcDirs = emptyList()
    }
}
I can't test it at the moment, but in theory it should make the Kotlin plugin unable to see your production code. You may also need to add an exclusion for the standard library to avoid adding a new dependency
l
Thanks, let me give it a shot. 👍