Hello, does anyone know how to get rid of these lo...
# multiplatform
l
Hello, does anyone know how to get rid of these log messages? I have them repeated hundreds of times in my builds because I have over 40 multiplatform modules targeting Android, and that makes eye scanning the logs way tougher.
Copy code
The Kotlin source set androidAndroidTestRelease was configured but not added to any Kotlin compilation. You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets>
z
I’m trying to get rid of this message too.. For now I just removed the
sourceSet
as I couldn’t add it to the compilation. To remove it you can just do:
Copy code
android {
      sourceSets.remove(sourceSets.getByName("androidAndroidTestRelease"))
}
Logs are gone on my side after this. I don’t think it’s anyhow perfect but since it’s not added to any compilation, shouldn’t make a difference when you remove it.
l
Thanks for the tip, I'll try it.
z
Also another way is to set up your
androidAndroidTestDebug
sourceSet to depends on
androidAndroidTestRelease
ones, apparently then it’s being added to the compilation. Like:
Copy code
android {
        sourceSets.getByName("androidAndroidTestDebug").dependsOn(sourceSets.getByName("androidAndroidTestRelease"))
    }
or
Copy code
val androidAndroidTestRelease by getting

        val androidAndroidTestDebug by getting {
            dependsOn(androidAndroidTestRelease)
        }
l
Thank you for the hint! This solved it in the root project's
build.gradle.kts
file:
Copy code
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

// buildscript and plugins block

allprojects {
    afterEvaluate {
        project.extensions.findByType<KotlinMultiplatformExtension>()?.let { kmpExt ->
            kmpExt.sourceSets.removeAll { it.name == "androidAndroidTestRelease" }
        }
    }
}
It wouldn't work if I didn't use
afterEvaluate
but tried to use
plugins.withType
+
configureEach
.
👍 4